Linked Questions

Popular Questions

im trying to query an ad from table named ads, using id of the ad i want, and based on that result, i use the ad_userposterid which is the id of the user who posted that ad, and use that ad_userposterid, to query the user row, snd get all his info from table members. why doing this?

first i need to get the information of the ad second i need the information of the user who posted that ad.

when a user post a ad to ads table, the user id get associated to the ad under column name ad_userposterid. my request:

is it possible to get the two rows data in just one query?.

i searched for example like this but i cant find answer where result is 2 rows from 2 different tables.

i know i can use promises in node.js and make 2 queries but, i want to know if no need for that, if possible get the same result with one query. thanks.

table 2 name: ads

| id |    ad_userposterid   |   ad_title           |   ad_price         |
| 1  |             2        |   Galaxy s9 for sell |     255            |
| 2  |             1        | iphone for for sell  |       200          |

table 1 name: members

| id |      user            |   phone              | 
| 1  | rida                 | 7277779999           |
| 2  | david                | 7278882222           |

Related Questions