简体   繁体   English

mysql:如何使用另一个表的两个不同值从一个表中选择两个不同的列值

[英]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. 我的目标是在单个查询中使用table1的字段a和b从table2中选择两个不同的值,例如c&d。

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)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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