Can you do SELECT within SELECT?


#1

Is it possible to do a select within a select query?

for example at the moment I have a compex query:

SELECT Meta().id AS ID, Type FROM myBucket WHERE ( Type IN ["Drop"] )  AND (ANY category IN Meta.Category SATISFIES (category IN [1,16,31,22]) END)  OR (Type = "User") AND (ANY userId IN Following SATISFIES (userId = 5931862670004191213) END)  AND ((Meta.Date >= "1264244356" AND Meta.Date <= "1416841899"))  ORDER BY Meta.Date Desc LIMIT 20 OFFSET 20

However I would also like to do something lIke:

SELECT Meta().id AS ID, Type FROM myBucket WHERE ( Type IN ["Drop"] )  AND (ANY category IN Meta.Category SATISFIES (category IN [1,16,31,22]) END)  OR (ID IN (SELECT Meta().id as ID FROM myBucket WHERE Type="USER" AND ANY userId IN Following SATISFIES (userId = 5931862670004191213) END))  AND ((Meta.Date >= "1264244356" AND Meta.Date <= "1416841899"))  ORDER BY Meta.Date Desc LIMIT 20 OFFSET 20

is this possible? at the moment I keep getting syntax errors, but don’t know if this is just a bracket in the wrong place or a String versus Int issue or similar?

Thanks.


#2

Hi,

Subqueries are not available in the current DP3. They will be available in DP4.