Hi Alec-
Your sub-select query can be written as:
select t1id from t1 left join t2 on t1id = t2id where t2id is null
in MySQL.
The example is actually given in the MySQL manual itself (section 1.7.4.1).
[EMAIL PROTECTED] wrote:
I am trying to check a table to see if a value doesnt exist,
Gopalarathnam V. wrote:
Your sub-select query can be written as:
select t1id from t1 left join t2 on t1id = t2id where t2id is null
in MySQL.
Too restrictive -- the original poster, Phil Dowson, wanted to find all
t1 rows except those that have t2.t2gid = 194 (or some other t2gid value).
The
Hi All,
I am new to this list, so appologies if I sound like a newbie.
I am trying to check a table to see if a value doesnt exist, and I
would prefer to use the NOT IN syntax, but that doesnt work for mysql.
I've been trying to construct a similar statement in MySQL, but I'm
coming up cold.
t1
I am trying to check a table to see if a value doesnt exist, and I
would prefer to use the NOT IN syntax, but that doesnt work for mysql.
I've been trying to construct a similar statement in MySQL, but I'm
coming up cold.
t1
't1id'
'1'
'18'
'19'
t2
't2id','t2gid'
'19','194'
Quoting Bruce Feist [EMAIL PROTECTED]:
Phil Dowson wrote:
Looks like a syntax error to me. There is no t1id in t2. Also, the OR
is redundant; if no t2 row was found, both t2id and t2gid will be NULL,
so checking one of them suffices. Try
SELECT t1.t1id
FROM t1 LEFT JOIN t2 ON
Quoting Bruce Feist [EMAIL PROTECTED]:
Phil Dowson wrote:
SELECT t1.t1id
FROM t1
LEFT JOIN t2 ON t1.t1id = t2.t2id
WHERE t2.t2gid 192 //an example of a gid I am using//
This is close, it shows all the id's that exist in the t2 table without a
t2.t2gid of 192, but I also need to
Phil Dowson wrote:
Literally in MSSQL server you would have (but I cant use subselects)
SELECT t1id FROM t1 WHERE t1id NOT IN (SELECT t2id FROM t2 WHERE t2gid = 192)
SELECT t1id FROM t1 left join t2 ON t1.t1id =t2. t2id AND
t2.t2gid = 192 WHERE t2.t2id IS NULL