A sort of Subset Union
Database January 28th, 2009SQL:
-
SELECT A.UserId
-
FROM
-
(
-
SELECT UserId FROM Users WHERE Email LIKE '%.com'
-
) A,
-
(
-
SELECT UserId FROM Users WHERE Email LIKE '%er%'
-
) B
-
WHERE A.UserId = B.UserId
Result A:
10059
10060
10061
10062
10063
10082
10058
10088
10089
Result B:
10059
10063
10087
10089
Result query:
10059
10063
10089
If there are other ways to acomplish this, please let me know.
Lieven Cardoen aka Johlero
January 28th, 2009 at 4:20 pm
SELECT UserId
FROM Users
WHERE Email LIKE '%.com'
AND Email LIKE '%er%';
Or maybe …
SELECT UserId
FROM Users
WHERE Email LIKE '%er%.com';