Results 1 to 5 of 5

Thread: data base query

  1. #1
    Join Date
    Jan 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default data base query

    Hi all.

    I have two tables: products and products_description. They have different number of columns. I want to select information from both tables with a single query. When I try the query below, I get a 1064 error. Can you help?

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,162
    Thanks
    263
    Thanked 690 Times in 678 Posts

    Default

    What's the query?
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Jan 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    My query is

    Select from Product, products_description order by Product.ID

    but getting error

  4. #4
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 517 Times in 503 Posts
    Blog Entries
    5

    Default

    You're not specifying which columns you want, for starters.
    You also need to specify how to join the tables.
    Read the MySQL docs on JOINs for more info.

    For example
    (not likely to work "as-is" -
    e.g., this assumes that the records in Product have "matching" rows in product_description and that they share ID numbers -
    plus, I don't know any of your column names aside from ID -
    if you want a more specific answer, share your table schema)
    :
    Code:
    SELECT `a`.`col1`,`b`.`col1` 
       FROM `Product` `a`
       JOIN `products_description` `b`
       ON `a`.`ID` = `b`.`ID`
       ORDER BY `a`.`ID`
    If you're looking for help, keep in mind that you need to provide as much information as possible.

    If you have a problem with a database query, you need to share your query and table schema.
    If you're getting an error, you need to share the error message.

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,027
    Thanks
    44
    Thanked 3,210 Times in 3,172 Posts
    Blog Entries
    12

    Default

    This thread has been closed due to age. If anyone wants information on it, please start a new thread. Feel free to link back to this one if you feel it contains information important to your new thread.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Similar Threads

  1. Replies: 2
    Last Post: 03-01-2013, 10:55 AM
  2. Data-base order on website
    By Timms in forum MySQL and other databases
    Replies: 1
    Last Post: 08-03-2012, 04:32 AM
  3. Java and SQL Data Base
    By judy in forum Java
    Replies: 2
    Last Post: 09-14-2008, 11:40 AM
  4. Can anyone help me with MS Access Data base
    By Dominick88 in forum MySQL and other databases
    Replies: 1
    Last Post: 07-11-2008, 05:36 AM
  5. Updating MS Access Data Base
    By dsmithmcse in forum MySQL and other databases
    Replies: 3
    Last Post: 12-29-2006, 03:01 AM

Bookmarks

Posting Permissions

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