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?
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?
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
My query is
Select from Product, products_description order by Product.ID
but getting error
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 inProduct
have "matching" rows inproduct_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.
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
Bookmarks