Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2003
    Posts
    6

    Thumbs up Unanswered: default value in query

    Is there a way to for a query to return a default value (specified in the query) if a request value is NULL?

    In my case I am returning an average wage for each employee record but people without wages should return some sort of default amount rather than just blank/null.

    Thanks

  2. #2
    Join Date
    Nov 2003
    Posts
    91
    SELECT employee, AVG(COALESCE(wagefield, 0))
    FROM emptable
    WHERE ...

    "0" in this example is the default value.

  3. #3
    Join Date
    Nov 2003
    Posts
    6

    Talking

    Awesome, thanks for the help. It worked perfect.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •