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. Only begin select if value is found in dataset sql

Only begin select if value is found in dataset sql

Scheduled Pinned Locked Moved Database
databasesalescollaborationquestion
3 Posts 3 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.
  • J Offline
    J Offline
    Joanna Webster
    wrote on last edited by
    #1

    Hi I wish to only begin a select statement if the top value date is found. It's my way of knowing data has been added into a system at the beginning of the month e.g max date is 01/01/2018. If not take the last day of the month 31/10/2018. Table is called sales. Column is called SaleDateFrom. I want to pull e.g data from SaleDateFrom <=01/01/2018...if not pull data SaleDateFrom <=31/12/2018 Any ideas team?

    L J 2 Replies Last reply
    0
    • J Joanna Webster

      Hi I wish to only begin a select statement if the top value date is found. It's my way of knowing data has been added into a system at the beginning of the month e.g max date is 01/01/2018. If not take the last day of the month 31/10/2018. Table is called sales. Column is called SaleDateFrom. I want to pull e.g data from SaleDateFrom <=01/01/2018...if not pull data SaleDateFrom <=31/12/2018 Any ideas team?

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      That does not make a lot of sense. If you ask for records whose date is less than or equal to 01/01/2018, then all records whose date is less than 31/12/2017 (I presume you mean 2017 here) will also fulfil the criteria.

      1 Reply Last reply
      0
      • J Joanna Webster

        Hi I wish to only begin a select statement if the top value date is found. It's my way of knowing data has been added into a system at the beginning of the month e.g max date is 01/01/2018. If not take the last day of the month 31/10/2018. Table is called sales. Column is called SaleDateFrom. I want to pull e.g data from SaleDateFrom <=01/01/2018...if not pull data SaleDateFrom <=31/12/2018 Any ideas team?

        J Offline
        J Offline
        jschell
        wrote on last edited by
        #3

        You want to pull the "most recent months" data. Yes that it possible. Didn't look but I am certain that google will display many answers for that. Add your specific database in do get a more relevant answer.

        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