in-subquery Questions

8

Solved

Is there a way (without JOIN) to use the WHERE clause on 2 columns (OR) IN a subquery? Currently, I'm doing WHERE 'col1' IN ( SELECT id FROM table ) OR 'col2' IN ( SELECT id FROM table ) And I...
Diez asked 9/7, 2012 at 10:41

6

Solved

The following MySQL query: select `userID` as uID, (select `siteID` from `users` where `userID` = uID) as `sID`, from `actions` where `sID` in (select `siteID` from `sites` where `foo` = "bar") or...
Plonk asked 30/12, 2009 at 16:9

4

I have tried to write a query statement with a subquery and an IN expression for many times, but I have never succeeded. I always get the exception, "Syntax error near keyword 'IN'". The ...
Seasoning asked 19/12, 2010 at 15:16

9

Solved

I am trying to do a query like this: DELETE FROM term_hierarchy AS th WHERE th.parent = 1015 AND th.tid IN ( SELECT DISTINCT(th1.tid) FROM term_hierarchy AS th1 INNER JOIN term_hierarchy AS th2...
Louella asked 17/12, 2010 at 14:15

4

Solved

I'm a newbie with the IQueryable, lambda expressions, and LINQ in general. I would like to put a subquery in a where clause like this : Sample code : SELECT * FROM CLIENT c WHERE c.ETAT IN ( SEL...
Astor asked 13/8, 2010 at 14:40

4

Solved

I came across this interesting behavior. I see left-join is the way to go, but would still like to have this cleared. Is it a bug or behavior by-design? Any explanations? When I select records fro...
Gravimetric asked 27/12, 2010 at 14:29

4

Solved

Assume the two tables: Table A: A1, A2, A_Other Table B: B1, B2, B_Other In the following examples, is something is a condition checked against a fixed value, e.g. = 'ABC' or < 45. I wrote a...
Liver asked 16/12, 2013 at 4:17

2

Solved

DELETE dbo.bBoxDetail FROM dbo.bBoxDetail AS BD INNER JOIN dbo.bBoxHeader AS BH ON LTRIM(RTRIM(BD.bBoxDetailId)) = LTRIM(RTRIM(BH.bBoxId)) WHERE LTRIM(RTRIM(BD.ESNs)) = (SELECT LTRIM(RTRIM(IMEI)) F...
Cordoba asked 9/7, 2013 at 15:56

1

Solved

I have two tables, locations and location groups CREATE TABLE locations ( location_id INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, name VARCHAR(63) UNIQUE NOT NULL ); INSERT INTO locations (name) ...
Spheroidicity asked 17/1, 2012 at 18:51

1

The following query returns 2036 rows: SELECT "FooUID" from "Foo" f LEFT JOIN "Bar" b ON f."BarUID" = b."BarUID" WHERE f."BarUID" IS NOT NULL AND b."BarUID" IS NULL But the following statement o...
Bil asked 11/9, 2011 at 20:14
1

© 2022 - 2024 — McMap. All rights reserved.