We help IT Professionals succeed at work.
Get Started

MYSQL query syntax

Kyle Hamilton
Last Modified: 2015-07-28
I'd like to export the combined results of two queries to CSV. The export to csv is not an issue.

I need help writing the query which will give me all the results I need. I'm using MySQLWorkbench.

I have some rows from this query:

SELECT * FROM iq.item where grouping_id='334' && class='D';

Open in new window

Then under each result, I would like to list the results from another query:

SELECT * FROM iq.comment where item_id = 2294;

Open in new window

where 'item_id' is the 'id' from the first query. there are multiple rows for each row in the first query.

I'm guessing these have to be joined?

Both tables have a date_created column, which I don't want to duplicate, as well as a content column, which is named differently. One is called 'description' and the second is called 'content'. I would like these two to become one column.

Please let me know if I need to clarify anything else.
Thanks in advance,
Watch Question
This problem has been solved!
Unlock 1 Answer and 5 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE