drill-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Shaw <rs...@maprtech.com>
Subject Sub-select
Date Mon, 10 Nov 2014 23:02:41 GMT
Hi, please can you confirm if the following type of sub-select query is
possible or how else to go about it.

Case 1:

Select …….
>From fish_data
Where  “fish_id”  in (select  “fish_id”  from ….. where ….)

Case 2:

Select  …
>From fish_data  fishd
Join (select … from  where …..)  fishtime   on fishtime.fishid =
fishd.fishid

Based on an existing query

MS SQL Example:

SELECT TOP 1
            fishId,
            datetime AS dataStart
FROM
            fish_data
WHERE
            fishId = '353234025714222'
            AND DATEDIFF(
                         dd,
                         (SELECT MIN(cake.datetime) AS minDate FROM
fish_data AS cake WHERE cake.fishId = '353234025714222'),
                         datetime
            ) > 5
ORDER BY
            datetime ASC

Thank you

Kind Regards,
Richard

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message