Paul DuBois wrote:


At 21:44 -0400 3/24/04, WebMaster Informática007 wrote:

Hi

I have problem with a Query.
It does not recognize EXISTS.
My version is MySQL 4.0.11a-gamma

Subqueries are supported beginning with MySQL 4.1.0.


http://www.mysql.com/doc/en/Subqueries.html
http://www.mysql.com/doc/en/Nutshell_4.1_features.html
http://www.mysql.com/doc/en/News-4.1.x.html


The query is:


SELECT U.usu_id, U.usu_login
FROM cva_usuario U
WHERE NOT EXISTS (SELECT * FROM cva_grupo_usuario GU WHERE GU.usu_id=U
usu_id Where GU.gru_id=4)

And if you don't want to upgrade, you can rewrite your query with a join instead of a subquery.


  SELECT U.usu_id, U.usu_login
  FROM cva_usuario U
  LEFT JOIN cva_grupo_usuario GU
  ON GU.usu_id=U.usu_id AND GU.gru_id=4
  WHERE GU.usu.id IS NULL

See <http://www.mysql.com/doc/en/Rewriting_subqueries.html>

Didn't you just ask this question yesterday?

Michael


-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to