there is a table
do not pay attention to field names
how to reduce it to mind
the most trivial is to group by column and join as many times as there are columns, but I think there is a more convenient solution
there is a table
do not pay attention to field names
how to reduce it to mind
the most trivial is to group by column and join as many times as there are columns, but I think there is a more convenient solution
This is called table transposition. Read http://easy4web.ru/?p=1099 - here chewed how to do it.
UPD: Although not exactly transposing in the direct sense of the term, the essence is the same.
Source: https://ru.stackoverflow.com/questions/556738/
All Articles
select 'пришло' as type,пришел, count(1) from table group by пришел union select 'болеет',болезнь,count(1) from table group by болезнь union ...
if you want of course, for one reading the table can be done, but there you have to mess with IF - Mike