Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 view min and max date where item last sold

Author  Topic 

enniwesw
Starting Member

8 Posts

Posted - 2009-07-09 : 08:55:51
failing to build a query to view date an item was last sold tried
but it ain't working

SELECT warehouse,product, MAX(movement_date) AS last_date_sold, MIN(movement_date) AS first_date_sold
FROM scheme.stkhstm
GROUP BY (product, warehouse)

rohitkumar
Constraint Violating Yak Guru

472 Posts

Posted - 2009-07-09 : 08:57:46
query looks correct, can you post some sample data and table structure?
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-07-09 : 09:20:39
ain't working
That is no information to force help.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

karthik_padbanaban
Constraint Violating Yak Guru

263 Posts

Posted - 2009-07-09 : 09:39:26
quote:
Originally posted by enniwesw

failing to build a query to view date an item was last sold tried
but it ain't working

SELECT warehouse,product, MAX(movement_date) AS last_date_sold, MIN(movement_date) AS first_date_sold
FROM scheme.stkhstm
GROUP BY (product, warehouse)




SELECT warehouse,product, MAX(movement_date) AS last_date_sold, MIN(movement_date) AS first_date_sold
FROM scheme.stkhstm
GROUP BY product, warehouse


Karthik
Go to Top of Page

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2009-07-09 : 13:53:15
quote:
Originally posted by webfred

ain't working
That is no information to force help.


No, you're never too old to Yak'n'Roll if you're too young to die.



How about "I will buy you a MAISEL'S WEIZEN KRISTALL-KLAR"

Will that force you to help?

http://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspx
How to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspx

For ultra basic questions, follow these links.
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-07-10 : 02:59:40
quote:
Originally posted by DonAtWork

quote:
Originally posted by webfred

ain't working
That is no information to force help.


No, you're never too old to Yak'n'Roll if you're too young to die.



How about "I will buy you a MAISEL'S WEIZEN KRISTALL-KLAR"

Will that force you to help?

http://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspx
How to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspx

For ultra basic questions, follow these links.
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp


Not a bad idea but i prefer this



No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -