php - SELECT QUERY to get the assistance of employees, in a range of hours -


I have a problem making QUERY this way:

I have this table, mt_reporteradial :

Image Details Here Enter

I need to follow the result in SELECT QUERY , for a few hours installation (for example: between 11h and 15h):

  Idmtpersonalr 11 12 13 14 15 3 - - - - X - 5 - - - xx 7 - - - xx  

Where indicador = 'S' < / Code> means in the result 'X' and ìndicador = 'N' means '-'

Is it possible with MySQL?

Edit: I have the answer:

My updated table:

QUERY :

  Separate selection (IDMTSNeller), Case (SELECT indicador WHERE idmtpersonalr = m.idmtpersonalr and hora = '13 'and fecha =' 2014-02-10 'from MT_RepererDial) when' S 'X' IO 'N' THEN '- '13 In the end, the case (MT_RepererDial from WHERE idmtpersonalr SELECT indicador = m.idmtpersonalr and Hora = '14' and fecha = '2014-02-10') WHEN 's' Now' X 'WHEN' N 'THEN' - '14 As DH End, case (SELECT indicador = m.idmtpersonalr and hora = '15 'and fecha =' 2014-02-10 'from MT_RepererDial WHERE idmtpersonalr) WHEN' S 'NOW' X 'WHEN' N 'THEN' - '15'hr As the end, the case (Select from MT_Repired radial indicator WHERE idmtpersonalr = m.idmtpersonalr and Hora = '16' and fecha = '2014-02-10') when 's' X' IO 'n' THEN '-' In the end 16_HR MT_edicial M  

Something can work like this:

< Pre> choose separately (idmtpersonalr), case (mt_reporteradial WHERE idmtpersonalr = m.idmtpersonalr and hora = '11') from the selection 'S' X 'IO' N 'again' - 'End Case as 11, Case (mt_reporteradial WHERE idmtpersonalr = m.idmtpersonalr and Hora = '12' by selection indicator) when 'S' then 'X' WHEN 'N 'THEN' - 'case of end as 12_HR, case (SELECT indicador WHERE idmtpersonalr = m.idmtpersonalr and Hora =' 13 'from MT_RepRADIAL) when' S '' X 'WHEN' N 'THEN' - 'END case 13_HR in the form, the case (mt_reporteradial WHERE idmtpersonalr = m.idmtpersonalr and hora = '14 'from the select indicator) when the' S 'X' IO 'N' then '-' end case as 14d, case (selection indicator or Ever since MT_ORPORATEDEDIZED WHERE id Mtpersonalr = m.idmtpersonalr and hora = '15 ') when' s 'x' when 'n' THEN '' mt_reporteradial meter from 15_HR as the end WHERE fecha = '2014-02-10' / code>

Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -