[英]MySQL-extract a number from db and use it in same query
table 1
in my db has many columns including id
and time
.我的数据库中的
table 1
有很多列,包括id
和time
。 an id is sent to the server, then I have to extract its corresponding time (let's say t
) from table and run a query like this:一个 id 被发送到服务器,然后我必须从表中提取其相应的时间(比如说
t
)并运行如下查询:
SELECT * FROM(
(SELECT * FROM table1 WHERE time>t AND ...clause 1...) // query A
UNION
(SELECT * FROM table1 WHERE time>t AND ...clause 2...) // query B
) h LIMIT 24;
how to include a subquery in the query mentioned above which extracts t
and makes it accessible by query A and query B?如何在上述查询中包含一个子查询,该子查询提取
t
并使其可由查询 A 和查询 B 访问?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.