Anthony Matovu
asked on
get the maximum value on a condition
Dear All
I want to write a sql statement giving me the most recent date when a customer paid for different products by product
Result should be like this
Customer ='James", last_date_paid_for_product 1='2016010 1", last_date_paid_for_product 2='2016020 1", last_date_paid_for_product 2
3='20160201",
Data is in this format
Customer Date_of_pay Product1 Product2 Product3
A 20161010 200 300
A 20161011 200
A 20161012 200
A 20161013 400 300
A 20161014 300
Result of the sql should be
Customer ='A", last_date_paid_for_product 1='2016101 2", last_date_paid_for_product 2='2016101 3", last_date_paid_for_product 2
3='20161014",
Thank you
Anthony
I want to write a sql statement giving me the most recent date when a customer paid for different products by product
Result should be like this
Customer ='James", last_date_paid_for_product
3='20160201",
Data is in this format
Customer Date_of_pay Product1 Product2 Product3
A 20161010 200 300
A 20161011 200
A 20161012 200
A 20161013 400 300
A 20161014 300
Result of the sql should be
Customer ='A", last_date_paid_for_product
3='20161014",
Thank you
Anthony
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You should rephrase this completely. You state two different resultsets, and have tagged the question wildly:
MS SQL Server MS Access .NET Programming
so no one knows what your are doing.
/gustav
MS SQL Server MS Access .NET Programming
so no one knows what your are doing.
/gustav
Customer ='A', last_date_paid_for_product
What is the data type for Date_of_pay ?