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 > newbie question: subqueries

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-28-04, 12:36
zaldun zaldun is offline
Registered User
 
Join Date: Feb 2004
Posts: 2
newbie question: subqueries

well it is quite strange, but when trying to execute any query with subquery i get parsing error (1064), no matter that i tried in phpmyadmin (could have been something related to that app.) and inside php code; i also tried in diferent hosts ( diferent MySQL installations)

well i tried a basic example of scalar subquery,from MySQL online doc, 13.1.8.1 section ( i have also tried with row subqueries ...) :

CREATE TABLE t1 (s1 INT);
INSERT INTO t1 VALUES (1);
CREATE TABLE t2 (s1 INT);
INSERT INTO t2 VALUES (2);

and then :

SELECT (SELECT s1 FROM t2) FROM t1;

so, then, mysql returns:

"
SELECT (


SELECT s1
FROM t2
)
FROM t1
LIMIT 0 , 30

MySQL said:


#1064 - You have an error in your SQL syntax near 'SELECT s1
FROM t2 )
FROM t1 LIMIT 0, 30' at line 2
"
well i have tried typing each char, also putting diferent quotes to fields,
and nothing; the inner query executed itself works perfectly, as well; so,
how is it possible to have a parsing error there ?;

do tables need any specific configuration?

thanks in advance for any answer ...
Reply With Quote
  #2 (permalink)  
Old 02-28-04, 12:58
walter71 walter71 is offline
Registered User
 
Join Date: Feb 2004
Location: Siggenthal, Switzerland
Posts: 19
In order to use subqueries in MySQL you will need a version of MySQL 4.1.

Which version do you have ?

Walter
Reply With Quote
  #3 (permalink)  
Old 02-28-04, 13:17
zaldun zaldun is offline
Registered User
 
Join Date: Feb 2004
Posts: 2
hi, oh well i didnt thought on it as a version issue! thought mysql already supposrted them! i use some already old 3.23.51 ... in own puter and at a remote server;

i had already thought on upgrading version to 4.x, so finally i will have to, at least at own puter, though i will still have to check that matter of checking or fixing DB users table perms, i think i read at Mysql website ..., no? ;

at remote server it will be mostly impossible to upgrade, so i will have to think on a php solution (2 indenpendient queries ..), though it will get slower ...

tyvm !!
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