sql - mysql display results horizontally -


I have written a few questions and I have found query results.

  created site SITE1 SITE3 SITE3 SITE4 SITE5 SITE6 SITE7 SITE8 SITE9 10/2/2014 63 NULL NULL NULL NULL NULL NULL NULL 10/2/2014 Nal Nell Nell Nell Nail Nail Nail Nail 10 10 / 3/2014 21 Nell nail nail nail nail nail nail nail nail 10/3 / 2014 Nail nail nail nail null faucet tap faucet 4   

Now I have to display this way.

  Creating site SITE2 SITE3 SITE4 SITE5 SITE6 SITE7 SITE8 SITE9 10/2/2014 63 NULL NULL NULL NULL NULL NULL 10 10/3/2014 21 NULL NULL NULL NULL NULL NULL 4   

Note: I'm already grouping and building the name of the site.

Do you have any good ideas or some thing tells me ..

  Enter the code here, select alldata.createdate, count (name), when the name = 'SITE1' then counting (1) as SITE1, when name = 'SITE2' then count (1) ends in SITE2, case when name = 'SITE3' then count (1) SITE3 When the case ends, the case when E = 'SITE4' is the matter of counting (1) as SITE4, when the name = 'SITE5' is counted as (1) SEET5, the case when name = ' SITE6 'then count (1) In the form of SET 6, 'SITE7' then count as STE 7 (1) case, when name = 'SITE8' then count (1) ends in the form of SETE 8, case when name = 'SITE9' Then counting (1) occurs in the form of SET 9, Total (Select. Name as the name by name, Separate DTR. *, Ps.name, DATE_FORMAT (dt.create_time, '% Y- % M-% d ') is created with di_dtb_task_result dtr dtr.task_id at d_dtb_task_data_detail dt = Dt.task_id and dt.user_id & lt;> 10000001 leave dtb_user_info ui on ui.id = dt. User_id and dtr.task_id = dt.task_id Please include dtb_point_site ps ps.id = ui.user_point_site_id and dtr.task_id = dt.task_id where dtr.status & lt; & Gt; 9 - group by dtr.status, dtr.task_id, ui.id, ui.user_point_site_id, ps.name command dtr.task_id) total - group total.name, total.createdate) alldata group alldata.createdate, Alldata.name    

I think you can try the maximum () function

From here you go with a sample for your reference to the maximum (site 9) group (..your_inner_query ..)

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

c++ - Qt::make_shared for creating QSharedPtr as std::make_shared for creating std::shared_ptr -