Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. multiple sql queries

multiple sql queries

Scheduled Pinned Locked Moved Database
database
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    twsted f8
    wrote on last edited by
    #1

    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

    B 1 Reply Last reply
    0
    • T twsted 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

      B Offline
      B Offline
      Blue_Boy
      wrote on last edited by
      #2

      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."

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups