Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2004
    Posts
    4

    Unanswered: space in field name

    Hi All,

    I have an imported database with a field name as follows:

    First name

    So because it has a space between the words, I am having troubles writing a query for it. Does anybody know the syntax to do this? I tried the following with now luck:

    Bring empty set even with a Joe in the table
    SELECT * FROM table WHERE 'First name' = "Joe";

    Same...
    SELECT * FROM table WHERE "First name" = "Joe";

    Gives error in syntax...
    SELECT * FROM table WHERE First name = "Joe";

    Any help would be appriciated.

  2. #2
    Join Date
    Jul 2001
    Location
    NC
    Posts
    102
    I suggest you remove the space in the field name (firstname) or replace the space with an underline (first_name).

  3. #3
    Join Date
    Mar 2004
    Posts
    4

    space in first name

    Thanks for the reply!

    A good idea, but I'm not sure if I can rename it. The data is coming from a daily download from a MS SQL export to Excel with about 60 different fields. It would be extremely time comsuming to do on a daily basis. It's a pretty big database.

    Is there some sort of script out ther to do this?

  4. #4
    Join Date
    Oct 2003
    Location
    Denver, Colorado
    Posts
    137

    Re: space in field name

    You need to use reverse quotes: `First Name`
    Code:
    SELECT * FROM table WHERE `First Name` = 'Joe';

  5. #5
    Join Date
    Mar 2004
    Posts
    4

    space in field name

    Ah! That did it!!!! Thanks!!

Posting Permissions

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