February 19, 2006 at 7:19 pm
I'm trying to check for 2 things
1) If There is a record that exists in phones with good = null or good = 1
AND
2) There is a record that exists in the extradata table with extracode of UU for any records found in #1
this isn't doing it. It's finding a bunch of records but I think it's ignoring the check for extradata table because there is no with ST for this account # so really, this select should be returning nothing:
SELECT 1
from phones p (NOLOCK)
inner join master m on m.number = p.number
INNER JOIN extradata e ON e.number = m.number
where ((p.good is null) or (p.good = 1))
and m.number = 672439
and e.extracode = 'UU'
February 20, 2006 at 2:05 am
What's with the 'with ST'...? The example is querying for 'UU'..?
If you look stright in the extracode table for the account, how does that look?
You could also try to change the 1/null check to COALESCE(p.good, 1) = 1
..and see of the 'or' stuff is messing things up in some way.
/Kenneth
February 20, 2006 at 6:00 pm
ST is just an inconsistency, I forgot to put UU in my post. Thanks for the suggestion!
February 24, 2006 at 2:14 am
So, do you still have the problem?
If you do, please post some sample data and the offending query to reproduce it.
/Kenneth
February 24, 2006 at 6:53 am
no more issues here, I've figured it out...thanks
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply