Benafsha Arya Benafsha Arya - 15 days ago 6
SQL Question

How can i user join on this SQL?

okay i have got this sql statement which someone helped me on here to make this statement the only problem im facing that i want catDesc from te_category table to be appear on my 'Category' table on main page but instead of that i'm getting catID from te_events

This is the code i got from stackoverflow.

$sql = "SELECT * FROM te_events
JOIN te_venue
ON te_venue.venueID = te_events.venueID
WHERE te_events.eventID = $eventID";


this my te_event table screenshot http://prnt.sc/d8e7i1
this is my te_category screenshot http://prntscr.com/d8e87e

I have tried anything but couldn't get what i want please HELP !

Answer

use this query:

$sql = "SELECT * FROM te_events 
JOIN te_venue 
ON te_venue.venueID = te_events.venueID 
JOIN te_category ON te_category.catID = te_events.catID 
WHERE te_events.eventID = $eventID";
Comments