If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Problem with SQL Query using EXISTS

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-19-04, 10:28
mccmartini mccmartini is offline
Registered User
 
Join Date: Sep 2003
Posts: 8
Red face Problem with SQL Query using EXISTS

Hi, I have a problem with an sql that uses EXISTS, and NOT EXISTS, but it throws me the error:
Syntaxis error or access violation
the query is:
SELECT *
FROM GRVALACD.TCRECLI
WHERE EXISTS
(SELECT *
FROM GRVALACD.TCREDSAL);
does anyone knows which is my error?
Thanks.
Reply With Quote
  #2 (permalink)  
Old 03-19-04, 15:19
Pat Phelan Pat Phelan is offline
Resident Curmudgeon
 
Join Date: Feb 2004
Location: In front of the computer
Posts: 12,606
Unless you are running the experimental 4.1 release of MySQL, sub-queries aren't supported, so neither is the EXISTS predicate.

You can approximate its behavior using JOIN operations, something like:
PHP Code:
SELECT a.*
   
FROM GRVALACD.TCRECLI AS a
   JOIN GRVALACD
.TCREDSAL AS b
      ON 
(b.fk a.pk)
   
WHERE  b.column 'fubar'
Where you join a to b on a key value and you specify whatever other constraints you need in the WHERE clause.

-PatP
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On