简体   繁体   中英

mysql :How to select two different column values from a single table using two different values of another table

My goal is to select two different values,say c & d from table2 using the fields a and b of table1 in a single query.

Any help would be deeply appreciated.

Thanks.

SELECT table2.c, table2.d
FROM table2
JOIN table1 ON table2.some_common_field = table1.other_common_field
WHERE (table1.a = XXX) AND (table1.b = YYY)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM