June 17, 2005 at 7:37 am
Good Morning everyone,
I don't understand why I got the error message for the below select statement. The weird thing is that I write the same way as the select statement below but sometimes it works sometimes it does not.
Can somebody direct me to the problem that I have in my select query, please?
Here is the select query:
**************
select a.* from TABLE1 a
where not exists (select b.* from TABLE2 b
where b.country_id = 61
and b.client_id = a.client_id)
and a.country_id =61
**************
Here is the error:
*************************
Server: Msg 279, Level 16, State 3, Line 1
The text, ntext, and image data types are invalid in this subquery or aggregate expression.
*************************
June 17, 2005 at 7:38 am
Change B.* to a column name that is not a text/image column, or to a constant like 1.
June 17, 2005 at 7:48 am
SELECT a.*
FROM TABLE1 a LEFT OUTER JOIN TABLE2 b
ON b.Client_Id =a.Client_ID
WHERE b.ClientID IS NULL
AND a.Country_Id=61
Vasc
June 19, 2005 at 4:12 pm
you can rewrite as:
--assume that country_id and client_id are not text/image type.
select a.* from TABLE1 a
where not exists (select 1 from TABLE2 b
where b.country_id = 61
and b.client_id = a.client_id)
and a.country_id =61
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply