multiple sql queries
-
Hie I am new to sql 05, and am buiding a windows app for a hotel. I would like to to retrieve the number of occupants in the various types of rooms on a between a specified date range. eg from the 1st of the month to the end of the month. For each day in the specified range I would like to retrieve the number occupants in each type of room. I have been able to do this by generating a different select statement for each day that is automatically updated by the program. I however feel that this method is very inefficient and would like to use a single sql statement to pull the data from the database and place it into a datatset. Does anyone have any idea on hw i cld get around this. thank u. tw5ted f8
-
Hie I am new to sql 05, and am buiding a windows app for a hotel. I would like to to retrieve the number of occupants in the various types of rooms on a between a specified date range. eg from the 1st of the month to the end of the month. For each day in the specified range I would like to retrieve the number occupants in each type of room. I have been able to do this by generating a different select statement for each day that is automatically updated by the program. I however feel that this method is very inefficient and would like to use a single sql statement to pull the data from the database and place it into a datatset. Does anyone have any idea on hw i cld get around this. thank u. tw5ted f8
Your query looks like:
select count(occupants) from tablename group by [datecol],roomtype having datecol between '2008-05-01' and '2008-05-31'
If this doesn't helps you then post data as they are saved in table and post output result which u want to have, we will see what we can do.
I Love T-SQL "Don't torture yourself,let the life to do it for you."