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. General Programming
  3. Visual Basic
  4. SQL return zeros

SQL return zeros

Scheduled Pinned Locked Moved Visual Basic
databasegame-dev
3 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    SELECT Sum(Amount) as "Total Expenditures", Month(eDate) as "Month" FROM Expenditure GROUP BY Month(eDate) ORDER BY Month(eDate) Above is my current SQL statement. I would like to change it so that it would generate a table that shows zeros for months that have zero "Total Expenditures". Currently it only shows amounts for months that have total > 0. I think I could do it once I get it into my datatable but the query would be nicer. Thanks "It has become appallingly obvious that our technology has exceeded our humanity." - Albert Einstein (1879-1955) "I think there is a world market for maybe five computers." - Thomas Watson (1874-1956), Chairman of IBM, 1943 "640K ought to be enough for anybody." - Bill Gates (1955-), in 1981 "Half this game is ninety percent mental." - Yogi Berra

    T 1 Reply Last reply
    0
    • L Lost User

      SELECT Sum(Amount) as "Total Expenditures", Month(eDate) as "Month" FROM Expenditure GROUP BY Month(eDate) ORDER BY Month(eDate) Above is my current SQL statement. I would like to change it so that it would generate a table that shows zeros for months that have zero "Total Expenditures". Currently it only shows amounts for months that have total > 0. I think I could do it once I get it into my datatable but the query would be nicer. Thanks "It has become appallingly obvious that our technology has exceeded our humanity." - Albert Einstein (1879-1955) "I think there is a world market for maybe five computers." - Thomas Watson (1874-1956), Chairman of IBM, 1943 "640K ought to be enough for anybody." - Bill Gates (1955-), in 1981 "Half this game is ninety percent mental." - Yogi Berra

      T Offline
      T Offline
      the_warlord
      wrote on last edited by
      #2

      :confused:How about a WHERE clause like 'WHERE Sum(things) = 0' at the end. The warlord

      L 1 Reply Last reply
      0
      • T the_warlord

        :confused:How about a WHERE clause like 'WHERE Sum(things) = 0' at the end. The warlord

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

        That would only retrieve months with zero expenditures. I want both months with zeros and months with amounts > 0 in one table.

        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