Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Dec 2004
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    SQL-question that wont work but is correct?


    I put up a survey for this thing I have to do to get my masters (education).
    The problem is that I get a "type-mixing" error. The SQL-question is:
    SELECT 9 FROM Survey WHERE 9 = '2'
    Now the thing is that since the survey is standardized the fields are called
    1-46 but it seems that SQL think it's a number bcs if I put 's around the 9 after the WHERE it runs or remove the 's around the 2. But that is not what I'am asking the DB for.
    Anyone?

    --------
    I think I solved it myself . Somewhere I rembered using ['s and it seem to work.
    Last edited by pinscher; 01-29-2005 at 12:17 PM.

  • #2
    New Coder
    Join Date
    Nov 2003
    Posts
    65
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Be more specific in what you are asking for by specifying the table name aswell.

    SELECT Survey.9 FROM Survey WHERE Survey.9 = 2

    You only need to add the apostrophes to the 2 if the datatype is text and not integer.


  •  

    Posting Permissions

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