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;

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

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

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
  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?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.