MySQL从值中进行选择的方式是什么?

select c from (values (1), (2), (3)) as t(c);

这个想法是能够做这样的事情:
select * from table, (values (1), (2), (3)) as temp(c) where ...;

供引用,以下是Postgres文档:
http://www.postgresql.org/docs/9.1/static/sql-values.html

最佳答案

通过您提供的链接:



所以你需要

select * from
table1,
(
   SELECT 1 AS val
   UNION ALL
   SELECT 2
   UNION ALL
   SELECT 3
)b

关于mysql - 从mysql中的值中选择,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/9216021/

10-15 18:48
查看更多