php - how to join 3 table without repeating the id? -
i have 3 tables: te_event, te_venue, te_category.
te_event table has columns: categoryid, venueid, event description, title, date, price.
te_venue table has columns:venueid, venuename , location.
te_category has columns: catid , catdesc.
here query
select * te_events inner join te_venue on te_events.venueid = te_venue.venueid inner join te_category on te_events.catid = te_category.catid
but show reapeating id
eventid | eventtitle | eventdescription |venueid | catid| eventstartdate |eventenddate |eventprice | venueid | venuename | location| catid | catdesc
why not select columns need? example:
select e.eventid, e.eventtitle, e.eventdescription, e.eventstartdate, e.eventenddate, e.eventprice e.catid, v.venueid, v.venuename, v.location te_events e inner join te_venue v on e.venueid = v.venueid inner join te_category c on e.catid = c.catid
it may bit longer may still give result expected.
cheers & good-luck.
Comments
Post a Comment