I have 2 tables. I want to get ProductID (primary key) from tblProduct using ProductUrl value. Then tblProduct.ProductID should join with tblImage.ProductID and give me only that one value of ImageUrl where ImageThumb = 1.
At the end I want that final 1 row of tblProduct all details and tblImage url.
Below are the tables
tblProduct:
ProductID | ProductUrl | ProductName |
---|---|---|
23 | eventone-cream | eventone cream |
24 | zertc-capsules | zertc capsules |
tblImage
ImageID | ImageUrl | ProductID | ImageThumb |
---|---|---|---|
1 | eventone.jpg | 23 | 0 |
2 | zertc.jpg | 24 | 0 |
3 | eventoe2.jpg | 23 | 1 |
4 | zertc3.jpg | 24 | 1 |
If my $url in php is = eventone-cream, then result should be
ProductID | ProductUrl | ProductName | ImageID | ImageUrl |
---|---|---|---|---|
23 | eventone-cream | eventone cream | 3 | eventoe2.jpg |
Please help me in this. I tried alot of variations but nothing worked. I did this with 2 seperate queries calls. But not able to do this in 1 go!