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
 SQL Server Development (2000)
 Count states of reservations

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2000-09-06 : 09:52:05
David writes "Hi,
I have a table named 'reservation' with this fields and values:
hotel_name state
---------- ----------
hotel1 processed
hotel1 canceled
hotel2 processed
hotel3 canceled
hotel1 processed
hotel2 processed
hotel3 canceled

What's the correct SELECT statement to get this listing?:

hotel_name #reservations #reservations
processed canceled
---------- ------------- --------------
hotel1 2 1
hotel2 2 0
hotel3 0 2

Thank you very much.

Congratulations for your pages.

David"

   

- Advertisement -