Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Order by

Status
Not open for further replies.

sparkme

Programmer
Oct 3, 2003
30
US

Sql Friends ,
I want to write a sql query to order the daily orders by date as well as number of orders per hour.Please help.

Thanks
Spark
 
What have you got so far?

[sub]____________ signature below ______________
The worst mistake you'll ever make is to do something simply the way you know how while ignoring the way it should be done[/sub]
 
order the daily orders by date as well as number of orders per hour

Here you go:

Code:
Select daily orders from the table with daily orders in it order by date as well as number of orders per hour.

*Not tested

[monkey][snake] <.
 
Friends I found the answer to this by myself.I added a column to the table (Table variable for temp result)
called DateId Which will be having id on the basis of DATETIME VALUE in the Order table Then I can order on the basis of DateId
 
I came to know that

There is No need to add a column on the basis of Datetime value I can use the function in the
SELECT DATEPART(hh,DateAdd)
and group by DATEPART(hh,DateAdd)


Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top