SELECT stl.storytitle
, stl.story_id
, stl.story_media
, stl.story_text
, stl.story_tags
, stl.story_date
, stl.category
, stl.location
, p.photo_file
, p.photo_id
, s.cust_id AS shpID
, s.cust_customer AS shipper
, s.cust_address AS sAddress
, s.cust_city AS sCity
, s.cust_state AS sState
, s.cust_zip AS sZip
, s.coordinates AS sCoo
, rcv.cust_id AS rcvID
, rcv.cust_customer AS receiver
, rcv.cust_address AS rAddress
, rcv.cust_city AS rCity
, rcv.cust_state AS rState
, rcv.cust_zip AS rZip
, rcv.coordinates AS rCoo
, t.tripid
, t.lmiles
, t.tid
, t.pickup
, t.delivery
, t.emptystart
, c.category AS storyCat
, c.id AS catID
, t.trailer AS trailerid
, us.username
, us.picture
, us.id AS authorID
FROM storyline stl
LEFT JOIN triplog t ON t.tid = stl.tid
LEFT JOIN customers s ON s.cust_id = t.shipper
LEFT JOIN customers rcv ON rcv.cust_id = t.receiver
RIGHT JOIN categories c ON c.id = stl.category
INNER JOIN users us ON us.id = stl.author
LEFT JOIN photos p ON p.photo_id = stl.story_media
WHERE stl.story_id LIKE ".$_GET["sid"]."
GROUP BY stl.story_id
ORDER BY stl.story_id ASC
This query lets me get what I need, but now I changed the triplog tables receiver column to comma separated values and I need to identify multiple ID’s in that field with the details stored in the customer table.
How would I do this ? I’m thinking I need a sub query ??