Jump to content

Subselect in MySql 3.23.46


wolf

Recommended Posts

Hi, I\'m having a problem with MySql 3.23.46 :?:

 

I\'m trying to execute a query which has a SUBSELECT.

f.e.:

 

$strSql = \"SELECT *\";

$strSql .= \" FROM Intervenciones I\";

$strSql .= \" WHERE IntDocId=\" . $docId . \" AND NOT EXISTS\";

$strSql .= \" (SELECT ResIntId FROM Respuestas R WHERE\";

$strSql .= \" R.ResResIntId=I.IntId)\";

 

OR

 

$strSql = \"SELECT *\";

$strSql .= \" FROM Intervenciones\";

$strSql .= \" WHERE IntId IN (SELECT ResResIntId FROM Respuestas\";

$strSql .= \" WHERE ResIntId=\" . $intId . \");\";

 

 

I read the MySql 4.1 manual and it says that SUBSELECT\'S are available.

 

I would like to know if my MySQL version is not able to run queries with SUBSELECT\'s.

?>[/code]

Link to comment
Share on other sites

:D thanks, you confirmed my suspects and investigation.

 

i had already solved my sql queries, i just wanted to confirm that my version is not able to run subselects.

 

I replaced old queries with:

 

$strSql = \"SELECT Intervenciones.*\";

$strSql .= \" FROM Intervenciones\";

$strSql .= \" INNER JOIN Respuestas ON (ResResIntId=IntId)\";

$strSql .= \" AND (ResIntId=\" . $intId . \");\";

 

AND

 

$strSql = \"SELECT Intervenciones.* FROM Intervenciones\";

$strSql .= \" LEFT JOIN\";

$strSql .= \" Respuestas ON Intervenciones.IntId=Respuestas.ResResIntId\";

$strSql .= \" WHERE Respuestas.ResResIntId IS NULL AND IntDocId=\". $docId;

 

 

 

Ahh !!!!! Sorry about my english, it could be bad because i speak spanish and i loose a little practice speaking english.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.