Page 1 of 1

nested query

PostPosted: 02. July 2011 08:42
by pplastiras
hi, i have a problem with a nested query i'm trying to create. the query code is:

Code: Select all
SELECT pc.pc_id, pc.pc_no, pc.pc_net, pc.pc_loc, pc.pc_name,
sw.swtch_id, sw.swtch_model, sw.swtch_rack, sw.swtch_loc,
conn.swtchconn_swtchid, conn.swtchconn_pcid, conn.swtchconn_portno
FROM pcs AS pc, switches AS sw, swtchconn AS con,
WHERE
con.swtchconn_pcid IN (SELECT pc_id, pc_no FROM pcs WHERE pc_id='11' || pc_loc='0' || pc_net='0' HAVING pc_no!=1) &&
con.swtchconn_swtchid IN (SELECT swtch_id, swtch_no FROM switches WHERE swtch_id='0' || swtch_rack='2' || swtch_loc='0' HAVING swtch_no!=1)


and the error message i get back is:

Error Code : 1064
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 'WHERE

con.swtchconn_pcid IN (SELECT pc_id, pc_no FROM pcs WHERE pc_id='11' || ' at line 9


I have read that maybe the falt is the mysql version but i think i'm working on mysql 5.1 so nasted queries are supported. can anyone help me!!!!!

Re: nested query

PostPosted: 02. July 2011 08:48
by Sharley
pplastiras wrote:but i think i'm working on mysql 5.1
The readme_en.txt file in the xampp folder will give you some certainty about which version of MySQL you are working with.

Re: nested query

PostPosted: 02. July 2011 10:09
by pplastiras
Yes my mysql is 5.1, so nested queries must be supported. have you got an idea about what is going wrong?