#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    Melbourne Australia
    Posts
    142
    Rep Power
    11

    Table called 'ORDER'...


    Im trying to write some queries to a database I didnt design and Ive found that they have created a table with the name 'ORDER'.

    Ive no idea why they would do this but they have, so my question is how the hell am I going to run queries on it.

    When i use say 'select * from order' it says that Ive a syntax error. And this is caused by the keyword order.

    Any ideas ?

    this table sits in a ms-access database which Im trying to query to update a mysql database.
  2. #2
  3. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,424
    Rep Power
    4539
    Try putting [ ] around the column name. For MS db servers this will let you use non-standard column names. Select * from [ORDER] should work for table names too.
  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Location
    Central Florida
    Posts
    76
    Rep Power
    11
    Valid SQL Code is:

    SELECT *
    FROM table_name
    WHERE parameters

    Some SQL requires you to terminate with a semicolon (;) at the end of the statement though.
  6. #4
  7. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    Melbourne Australia
    Posts
    142
    Rep Power
    11
    putting [] round the table name like [order] let me prepare the statement. thanks for that.

    Although this worked it showed me another problem, maybe my documentation is wrong on this database.
    So i wanted to list all tables in the database by using :
    show tables;
    This also errors. Where could I find valid sql for a ms access database.

IMN logo majestic logo threadwatch logo seochat tools logo