0

here i have 3 tables. i want to display OfferDescription,OfferImage,offerPath based on spaid.becaz offerimage and offerdescription are added by using array.so its in different table.

if i add companyname and 2 offerimage and 2 offerdescription its added in this 3 tables.after i have to display based on spaid value.i tried but its taking multiple. i d't know which query i have to use. give some suggestion

SELECT `id`, `OfferDescription`, `spaid` FROM `offerdescription`;
SELECT `offimgid`, `OfferImage`, `offerPath`,`spaid` FROM `o dffersimagegallery`;
SELECT id,companyName FROM spa;
3
Contributors
4
Replies
29
Views
3 Years
Discussion Span
Last Post by nadiam
0

A join might be what you are looking for. In order to join, you need to identify a map between the each table. For offersescription and odoffersimagegallery it would likely be spaid. I cannot tell what it would be for spa.

Sorry for typoes, on a phone atm.

A join would look like this:

Select od.id, od OfferDescription, od.spaid, odf.offimgid, odf.offerimage, odf.offerPath from offerdescription od
Join odffersimagegallery odf on odf.spaid = od.spaid

0

i tried but am getting multiple times its showing i want to display description and image once

Attachments re.png 36.62 KB
0

i tried but its showing multiple times

SELECT og.`offimgid`,og.`OfferImage`, og.`offerPath`,og.`spaid`, od.id,od.OfferDescription,s.`id` as sid FROM `offersimagegallery` og LEFT JOIN spa s ON s.id=og.spaid LEFT JOIN offerdescription od ON od.spaid=s.id WHERE s.id=401

Edited by malatamil: fgdrgf

Attachments res.png 19.46 KB
0
  SELECT og.offomgid,og.OfferImage,og.offerPath,og.spaid,od.id,od.OfferDescription,s.id FROM offersimagegallery og INNER JOIN spa s ON s.id = og.spaid LEFT OUTER JOIN offerdescription on ON s.id = od.spaid WHERE s.id = 401

does it show multiple? does it show anything?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.