Re: Last order date for each customer
- From: Hugo Kornelis <hugo@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 08 May 2006 22:13:01 +0200
On Mon, 8 May 2006 09:32:01 -0700, chas2006 wrote:
I would like to write a select statement in query analyzer which would return
the last order number per customer given a specific order type. (Which would
be 1 record per customer) Thanks.
Hi chas2006,
Questions like this are imppossible to answer without knowing how your
database looks. Please post table structure (as CREATE TABLE statements,
including constraints and properties), some rows of sample data (as
INSERT statements) and expected results.
Maybe something like this?
SELECT Customer, MAX(OrderNumber)
FROM Orders
WHERE OrderType = 17
GROUP BY Customer
--
Hugo Kornelis, SQL Server MVP
.
- Prev by Date: Re: Help on : Could not find stored procedure 'recurse_oids'
- Next by Date: Re: UPDATE TABLE1 ONLY WHEN ALL RECORDS IN COLUMN IN TABLE2 ARE TRUE
- Previous by thread: Re: Help on : Could not find stored procedure 'recurse_oids'
- Next by thread: Re: UPDATE TABLE1 ONLY WHEN ALL RECORDS IN COLUMN IN TABLE2 ARE TRUE
- Index(es):