Starting with a list containing 1-2,000 customer id's, I need to generate a query that gives me the orderid for each customer, of the earliest order associated with that customer. So I have a two-part challenge:
The only way I can think of to retrieve the same list of customers is with a code-generated where clause listing each of the id's. Doesn't smell right, so I thought I'd post it here for feedback. S'ok? Not ok? (SQL 2000)
Second, how to retrieve only the oldest orderid for each customer? Where I also need to ignore orders that cost less than $10.
The fields are:
customers.customer_code (pk, varchar)
order_entry.job_number (pk, int)
Help much appreciated-