May 4, 2005 at 2:41 pm
I'm trying to pull the first occurance (date) of when a product hits a certain location. The table I'm using contains ProductID (varchar 50) and InvoiceDate (DateTime). I've tried using a "Top" clause, but of course that doesn't work. How can I pull the first date by product? Thanks in advance.
May 4, 2005 at 2:48 pm
Select Min(InvoiceDate)
From your_table
Where product_id = '123'
-------------------------------------
Select top 1 InvoiceDate
From your_table
Where product_id = '123'
Order by InvoiceDate
May 4, 2005 at 2:49 pm
Could you provide some sample data with expected resultset ?!
**ASCII stupid question, get a stupid ANSI !!!**
May 4, 2005 at 2:53 pm
If you are still having a problem please post the exact statement you are trying to run, a sample of the output and why you think it is not correct.
May 4, 2005 at 2:58 pm
I'm running the statement now using the "min" function. Will keep you posted
May 5, 2005 at 8:26 am
Yep, that will do the trick...
May 5, 2005 at 11:48 am
Min worked great! Thanks for the help.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply