Search Postgresql Archives

Re: Bringing other columns along with a GROUP BY clause

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sam,

Great!  I had no idea DISTINCT ON existed.  That made it much simpler.
Here's what I used:

select distinct on (inventory.charge) coil_id, inventory.charge,
heating_coldspot_time_reached
from inventory
inner join charge on charge.charge = inventory.charge 
where base_type = '3' and heating_coldspot_time_reached > 0 and
inventory.status = 'Done' and inventory.charge >= 1000
order by charge, heating_coldspot_time_reached desc

And thanks for the tip about E-mail.  I thought that if I hit the Reply
button and then changed the subject line, it would be the same as
sending a new message to the same destination.  In this case, I had to
change the destination also, so it looked like a brand new message.  I
didn't know I was bringing along old baggage behind the scenes.

Thanks very much!

RobR

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux