Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools

Zandy Rox
Zandy Rox
3,982 Points

Can you please help optimize my SQL statement?

If I needed help with my SQL statement, but I don't want to post my statement, will you still be able to help?

3 Answers

Zandy Rox
Zandy Rox
3,982 Points

Can you help optimize my SQL statement?

Here it is:

SELECT * from (SELECT ven_vendor_id, string(ven_vendor_id) as ven_vendor_id_string, ven_vendor_name, inv_amount_paid, accounting_date_calendar_year FROM table A) a INNER JOIN ( SELECT ven_id, Ven_name, GROUP_CONCAT_UNQUOTED(podist_item_description, "; ") AS podist_item_description FROM table b GROUP BY ven_id, Ven_name) b ON a.ven_vendor_ID = b.ven_ID INNER JOIN ( SELECT ven_vendor_ID, ven_country FROM table C) c ON c.ven_vendor_ID = a.ven_vendor_ID INNER JOIN ( SELECT Vendor_ID, Supplier_Type, Capabilities, Secondary, Description, website, primary_team_member, simba_deal_ID_Number FROM Table D) d ON a.ven_vendor_id_string = d.Vendor_ID

We can help you with your statement but we'd really need to see some code or an explanation of what you're trying to do.

Are you stuck on a specific challenge? If so can you post a link?

Zandy Rox
Zandy Rox
3,982 Points

I be more comfortable emailing the code. I don't know if thats a possibility.

Not unless someone is willing to post their email address on a public forum. There's no way to send private messages on here either.

If your code contains sensitive info like usernames, passwords or personal information, just provide a sample using generic info. i.e use SELECT * FROM users WHERE password = "12345" instead of the actual password.

If you don't want people to see your code because you think it looks really bad. Don't worry about it, it's probably not as bad as you think. No one will judge you and posting your code may help someone else in the same situation.

Hope this helps :)