You are here: Re: How do I do this query? « PHP Programming Language « IT news, forums, messages
Re: How do I do this query?

Posted by 4partee on 09/26/40 11:37

On Sun, 15 Jan 2006 19:28:14 -0500, Jerry Stuckle wrote:

> manny wrote:
>> I wish I knew what this was called, and I could have made a more sensible
>> subject. For that matter, I knew what it was called, I could have googled it!
>>
>> Anyway, let's I have a table with name, class, grade.
>>
>> joe bio a
>> jill chem b
>> john psych b
>> john chem a
>> jill pysch a
>>
>> and I want to display the results as
>>
>> name bio psych chem
>> joe a - -
>> jill - a b
>> john - b a
>>
>> Is there a way to do this with sql? How about sql with php?
>>
>> Thanks much!
>>
>> Manny
>

SELECT name, IF(class = 'bio', grade,'-') AS `bio`
, IF(class = 'psych', grade,'-') AS `psych`
, IF(class = 'chem', grade,'-') AS `chem`
from tablex

Actually, mysql really sucks at this!

John

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация