Hello friends,
I have a problem. I have this table X which has fields Col1,Col2,ColDate.
The data in all these fields can be duplicate except in ColDate.eg
Col1 Col2 ColDate
1234 MName 10/23/2004 11:00:00 AM
3456 MName 10/17/2004 9:00:00 AM
1234 MName 10/24/2004 11:00:00 AM
Then I have a stored procedure SP_Retrive with which the distinct values of X are joined with Left Join on Col1.
So that when I display records only one instance of 1234 comes up. But I want to display the data in descending order of weekday of ColDate.
e.g. if Oct 23 is Saturday for 1234 then it should appear above 3456 which has date of Oct 17 but that is Sunday.
How do I do this.
The distinct values from table X are retrived using foll View.
SELECT DISTINCT
Col1,Col2
FROM X
WHERE ColDate >= (getdate()- 0.083333333)
I tried to order this view using Top 100 Percent. But then it does not select Distinct values. This causes the records to appear more than ones.
Help!!
vw.
I have a problem. I have this table X which has fields Col1,Col2,ColDate.
The data in all these fields can be duplicate except in ColDate.eg
Col1 Col2 ColDate
1234 MName 10/23/2004 11:00:00 AM
3456 MName 10/17/2004 9:00:00 AM
1234 MName 10/24/2004 11:00:00 AM
Then I have a stored procedure SP_Retrive with which the distinct values of X are joined with Left Join on Col1.
So that when I display records only one instance of 1234 comes up. But I want to display the data in descending order of weekday of ColDate.
e.g. if Oct 23 is Saturday for 1234 then it should appear above 3456 which has date of Oct 17 but that is Sunday.
How do I do this.
The distinct values from table X are retrived using foll View.
SELECT DISTINCT
Col1,Col2
FROM X
WHERE ColDate >= (getdate()- 0.083333333)
I tried to order this view using Top 100 Percent. But then it does not select Distinct values. This causes the records to appear more than ones.
Help!!
vw.