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 select in 1 query

Multiple select in 1 query

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.
  • A Offline
    A Offline
    Agweet
    wrote on last edited by
    #1

    Hi...can any1 assist me plz....im using sql 2005...i have multiple selects seperated by if statements like this:

    IF @Monday = 0
    SELECT [Day],[Date] FROM dbo.fnGetDatesforAday('2008/09/10', '2008/09/30','Monday')

    IF @Tuesday = 1
    SELECT [Day],[Date] FROM dbo.fnGetDatesforAday('2008/09/10', '2008/09/30','Tuesday')

    is there a way to execute both selects as 1 query

    living life on the flip side

    N 1 Reply Last reply
    0
    • A Agweet

      Hi...can any1 assist me plz....im using sql 2005...i have multiple selects seperated by if statements like this:

      IF @Monday = 0
      SELECT [Day],[Date] FROM dbo.fnGetDatesforAday('2008/09/10', '2008/09/30','Monday')

      IF @Tuesday = 1
      SELECT [Day],[Date] FROM dbo.fnGetDatesforAday('2008/09/10', '2008/09/30','Tuesday')

      is there a way to execute both selects as 1 query

      living life on the flip side

      N Offline
      N Offline
      N a v a n e e t h
      wrote on last edited by
      #2

      SELECT
      [Day],[Date]
      FROM
      dbo.fnGetDatesforAday('2008/09/10', '2008/09/30',(
      SELECT
      CASE @Monday
      WHEN 0 THEN 'Monday'
      WHEN 1 THEN 'Tuesday'
      ELSE 'Other'
      END

      )
      )

      It's a wild guess, I haven't executed it though.

      All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions

      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