List:General Discussion« Previous MessageNext Message »
From:Robert M (Bob) Bartis Date:May 25 2005 10:40pm
Subject:RE: Subquery question
View as plain text  
Apologize for not including the error:

You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL
server version for the right syntax to use near 'SELECT plantriggers.ID  FROM
plantriggers  WHERE (((plantrigger

I'm running MySQL 4.0.2-standard


-----Original Message-----
From: Bartis, Robert M (Bob) [mailto:bartis@stripped]
Sent: Wednesday, May 25, 2005 6:29 PM
To: 'mysql'
Subject: Subquery question


I have a problem where I need to use a subquery in combination with a Left Join. The SQL
statement below works fine until I introduce the subquery portion. Specifically, 

WHERE testplans.plantriggers_ID_FK IN (SELECT plantriggers.ID  FROM plantriggers  WHERE
(((plantriggers.testplan_intro_PlanID_FK)=1)))

Can someone point out where the error is. I double checked the column name/tables names in
the above portion and as I said the main body worked prior to introduction of the
subquery. I've also tried replacing the IN operand with an = with no luck.
 
 
Full SQL statement:
 
SELECT testplans.SubTestCaseKey,  testcase_root.ID, testplans.testcasesuffix_name_FK, 
testcase_root.TestID, testcase_root.TestDesc, testplans.FSAGA,  testplans.Priority,
testplans.tester_list_Name_FK  FROM testcase_root LEFT JOIN testplans ON testcase_root.ID
=  testplans.testcase_root_ID_FK  WHERE testplans.plantriggers_ID_FK IN (SELECT
plantriggers.ID  FROM plantriggers  WHERE (((plantriggers.testplan_intro_PlanID_FK)=1)))
  ORDER BY testcase_root.TestID;

Robert M. Bartis 
Lucent Technologies, Inc 
Tel: +1 732 949 4565 
Mail: <bartis@stripped> 
Pgr: <rmbartis@stripped> 

 
Thread
Subquery questionBob)26 May
RE: Subquery questionBob)26 May
  • Re: Subquery questionDan Nelson26 May
RE: Subquery questionBob)26 May