|
Posted by Johnny on 09/14/06 19:33
"j0sh" <josh@pixael.com> wrote in message
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)
i still can't figure what you are trying to do as your original q asked:
'why if i make a select with "group by" and "order by id desc" mysql
select ever the first id and not the last?'
and now you show a new sql that has ORDER BY a.date
so your question no longer makes sense.
Also you made another mistake: your sql is broken, it should say 'SELECT
a.*, b.* FROM ...'or just 'SELECT * FROM...'
OTOH that query when the select part is fixed does just as expected orders
by a.date not by id since that what it asks.
WHERAS if you do
'select a.*,b.* from a,b where a.id=b.id group by a.id order by a.id'
which may what you meant, (only you can say, I have to infer here..;-), it
does what you'd expect: group by a.id and orders by a.id.
As in, works for me.
So now, what is your question?
Navigation:
[Reply to this message]
|