我试图从特定表中获取所有行,如果在特定表的任何列中找到值。
you can just use IN
. eg
SELECT *
FROM tbName
WHERE yourValue IN (column1, column2, column3, ....)
You can probably use the EXISTS
to do your job.
Below query will get the stores name only if city 2 has a name.
SELECT store_name FROM stores WHERE EXISTS (SELECT name FROM cities WHERE id = 2);
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.