I have played around with many different queries, but haven't been able to locate the right syntax for this project.. I really hope someone can make sense of my mess.I have a table with orders, one row per order, and each row containing info such as the customer number, PO#, and date of the order.A PO number can be tied to one or more orders, which is where I am getting lost.I am trying to create a query that will produce a single row containing the customer number, PO#, date of the earliest order, and date of the last order, grouped by the PO#.Any pointers in the right direction will by much appreciated!
Which PO# do you want?That of the earliest order?That of the last order?Something else?
Do all rows with same PO have the same CustomerNumber too?
Wow... clean, simple, and worked like a charm!
by doing a sub-select as a column will be a big performance hit, especially on larger tables.It requires each SELECT MIN() to be called for every ID vs using the standard MIN() / MAX() across all the qualified records.You have the group by which results the same one record per P/O