Results 1 to 5 of 5
  1. #1
    Join Date
    May 2010
    Posts
    13

    Unanswered: Select to include static value in results

    My question is pretty straightforward (I think!).

    I am trying to write a select statement that includes a constant as one of its values. It is:

    SELECT workerID, FirstName + ' ' + LastName AS VendorName, nickname, address, city, state, zip, phone. 0 from tblWorker

    It is, of course, the 0 at the end of the statement that I need present in each row. Can anyone assist?

    Thanks!

    Dan

  2. #2
    Join Date
    Aug 2009
    Posts
    262
    select magazinename,mth,country,t.zero from magazine, (select 0 as zero) t

    i know u can do better .. it is just a rough scratch

  3. #3
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Code:
    --Yours
    SELECT workerID, FirstName + ' ' + LastName AS VendorName, nickname, address, city, state, zip, phone. 0 from tblWorker
    
    -- Swap the period for a comma and add an alias
    SELECT workerID, FirstName + ' ' + LastName AS VendorName, nickname, address, city, state, zip, phone, 0 As some_constant from tblWorker
    George
    Home | Blog

  4. #4
    Join Date
    May 2010
    Posts
    13
    Neither of those worked.

  5. #5
    Join Date
    May 2010
    Posts
    13
    Sorry, my mistake. Solution 2 did work. Next time I'll remember to put in the correct punctuation!

Posting Permissions

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