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)
 GROUP RECORDS FROM 1 TABLE

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-01-22 : 10:09:26
Andris writes "I have one table with orders.
The problem is that I want to sort this records by DATE (when they were made) and by Order company names.
How could I make it from 1 table?

I tried something like this:
"SELECT ID, Date_Ordered, Company FROM ORDERS ORDER BY ORDER_DATE AND GROUP BY COMPANY"

BUT THIS RETURNS AN ERROR.

How could Imake this query work?

Thanks

[I have WINNT AND SQL SERVER 2000]"

KnooKie
Aged Yak Warrior

623 Posts

Posted - 2002-01-22 : 10:21:57
Your group by and order by statements are the wrong wat round i believe

Go to Top of Page

Nazim
A custom title

1408 Posts

Posted - 2002-01-22 : 10:30:44
SELECT ID, Date_Ordered, Company FROM ORDERS ORDER BY ORDER_DATE ,company

should do what you are looking for.




--------------------------------------------------------------
Dont Tell God how big your Problem is , Tell the Problem how Big your God is
Go to Top of Page
   

- Advertisement -