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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Query With Distinct, Date selection and Sort BY.

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-10-25 : 10:57:10
Bjorn writes "Hi SQLTEAM,
I have a problem with my ASP page, I now you guys Preffer only SQL-Server questions so I'll be very happy with only the Query.

Here's my problem:
I have 1 Table with data about a referrer from my website that looks like this:

Date		Url			Total
15-10-01 Http://something/ 65
16-10-01 http://something/ 123
16-10-01 http://something_2/ 100
17-10-01 http://something/ 99
17-10-01 http://something_2/ 78


And let's say that the date selection will be 16-10-01 to 17-10-01 (The first record isn't counted as you can see)

And this is the result I want:

URL			Total
Http://something/ 222
Http://something_2/ 178


So The things I want to be in the Query are :
- WHERE Date BETWEEN #16-10-01# AND #17-10-01#
- SORT BY Total DESC

I Tried a lot of stuff but I just can't figure it out.

Can you guys help me?
Thanx

Bjorn Huijbregts"
   

- Advertisement -