Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Identical Queries - Different Results

Status
Not open for further replies.

Tim1

Programmer
Mar 27, 2001
242
GB
Hi All,

I am running the following queries, which although they should be identical are returing different results:

Query 1
---------

SELECT org_num_int_eur,
service_type,
pkg_num,
card_type
INTO #tmp_xec
FROM vms_mis..mis_xec
WHERE last_update IS NULL

This gives 3,892 rows affected

Query 2
---------

SELECT COUNT(*)
FROM vms_mis..mis_xec mis,
#tmp_xec tmp
WHERE mis.org_num_int_eur = tmp.org_num_int_eur
AND mis.service_type = tmp.service_type
AND mis.pkg_num = tmp.pkg_num
AND mis.card_type = tmp.card_type

This, when run after the query above, gives 0 rows.

I am sure that I must have missed something very obvious, but cannot see it...

Any pointers??

Thanks,

Tim
 
All,

Thanks for any work that you have done on this, we now have the answer. The problem was the db designer! who told me that none of these fields could be null, when in fact, card type could be, and as we all know, NULL does not equal anything, even another NULL.

Thanks again,

Tim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top