How to connect two query results?
Posted
by
nijansen
on Stack Overflow
See other posts from Stack Overflow
or by nijansen
Published on 2012-06-19T14:13:07Z
Indexed on
2012/06/25
3:16 UTC
Read the original article
Hit count: 122
I want to retrieve all ids within a certain timespan. The timestamps however, are stored in a different table:
Table A has column my_id
Table B has columns my_id, timestamp
I would want something like
SELECT
id,
time
FROM
(SELECT my_id AS id FROM A) q1,
(SELECT timestamp AS time FROM B WHERE my_id = id) q2
;
But how can I get the value of id
within a different subquery? Is there
an elegant solution for this problem?
© Stack Overflow or respective owner