joby
02-14-2008, 02:41 AM
Please see the query
select distinct city,numb from res where id=10 and _date='2008-05-02' order by numb,city;
out put is
city | numb
---------------+---------------
DELHI | 10
DELHI | 11
AGRA | 12
I want to avoid duplicate cities .(DELHI)
That is the out put will be
city |
------------------
DELHI |
AGRA |
Make sure DELHI will be in the first record . because its numb is less than that of AGRA.
How to rewrite the query.
select distinct city,numb from res where id=10 and _date='2008-05-02' order by numb,city;
out put is
city | numb
---------------+---------------
DELHI | 10
DELHI | 11
AGRA | 12
I want to avoid duplicate cities .(DELHI)
That is the out put will be
city |
------------------
DELHI |
AGRA |
Make sure DELHI will be in the first record . because its numb is less than that of AGRA.
How to rewrite the query.