Page 1 of 1
Select error with left Join
Posted: Wed Jun 15, 2005 4:53 am
by Catzwolf
Code: Select all
SELECT a.* FROM table_a a LEFT JOIN table_b b ON b.lid=a.lid WHERE a.published > 0 AND a.published <= 1118827824 AND (a.expired = 0 OR a.expired > 1118827824) AND a.offline = 0 AND b.cid=a.cid OR (a.cid=1 OR b.cid=1) ORDER BY published DESC
I am having problems getting this query to work correctly, while the actually join seems to work, for some reason it ignores this part of the query and displays published, expired or online regardless of what is actually stored in these fields:
Code: Select all
WHERE a.published > 0 AND a.published <= 1118827824 AND (a.expired = 0 OR a.expired > 1118827824) AND a.offline = 0
Many thanx for your help
John
Re: Select error with left Join
Posted: Wed Jun 15, 2005 6:29 am
by Catzwolf
Catzwolf wrote:SELECT a.* FROM table_a a LEFT JOIN table_b b ON b.lid=a.lid WHERE a.published > 0 AND a.published <= 1118827824 AND (a.expired = 0 OR a.expired > 1118827824) AND a.offline = 0 AND b.cid=a.cid OR (a.cid=1 OR b.cid=1) ORDER BY published DESC
I am having problems getting this query to work correctly, while the actually join seems to work, for some reason it ignores this part of the query and displays published, expired or online regardless of what is actually stored in these fields:
WHERE a.published > 0 AND a.published <= 1118827824 AND (a.expired = 0 OR a.expired > 1118827824) AND a.offline = 0
Many thanx for your help
John
Should have been:
Code: Select all
SELECT a.* FROM table_a a LEFT JOIN table_b b ON b.lid = a.lid
WHERE a.published > 0 AND a.published <= 1118834480
AND (a.expired = 0 OR a.expired > 1118834480)
AND a.offline = 0
AND (b.cid=a.cid OR (a.cid=1 OR b.cid=1))
ORDER BY published DESC