You are here: Re: mysql group by and order... « All PHP « IT news, forums, messages
Re: mysql group by and order...

Posted by <info on 09/14/06 19:24

If the table B is containing the multiple values from A and you want all
values out of table B displayed, then you should work backwards

table B

id (integer auto_increment etc)
description (varchar 255)

table B

id (integer auto_increment etc)
a_id (int)
field 1
field2
etc


// old
select *.a,*.b from a,b where a.id=b.id group by a.id order by a.date
// new
select *.a,*.b from b,a where b.a_id = a.id group by a.id order by a.date

Jerry

"j0sh" <josh@pixael.com> schreef in bericht
news:4509261a$0$15865$4fafbaef@reader2.news.tin.it...
> Johnny wrote:
>
>> desc doesn't apply to 'group by' AFAIK(not much...)
>> http://www.techonthenet.com/sql/group_by.php
>>
>> desc usually used with 'order by'
>
> sure... but i'm using desc with order by...
>
> the right example is
>
> select *.a,*.b from a,b where a.id=b.id group by a.id order by a.date desc
> (i make a mistake in my example)

 

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

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