Tom Lane writes:
> I have a feeling that it could also be done via the "window functions"
> feature due to be introduced in 8.4, but I'm not entirely sure how.
> Anybody feeling handy with those?
There may be a better way but something like
select * from (select *, rank() over (partition by ch
Thanks very much, Tom. While the DISTINCT ON suggestion answered the
question I asked very neatly and I am glad to add that concept to my
arsenal, your standard-compliant query was what I actually needed. The
DISTINCT ON query only gave me one coil if there were two coils in a
charge that had the
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_co
"Rob Richardson" writes:
> I have a table that has three interesting columns: coil_id, charge, and
> coldspot_time. A charge can have several coils, so there are several
> records with differing coil_ids but the same charge. I want a list of
> the coils whose coldspot_times are the largest for
[ Rob, it would help if you didn't "reply" to unrelated messages.
Decent mail programs automatically "thread" emails based on what you
reply to and hence unrelated messages like yours tend to get lost. ]
On Thu, Feb 05, 2009 at 02:43:07PM -0500, Rob Richardson wrote:
> I want a list of
> the
Greetings!
I've run into this problem a few times. There must be a solution, but I
don't know what it is.
I have a table that has three interesting columns: coil_id, charge, and
coldspot_time. A charge can have several coils, so there are several
records with differing coil_ids but the same