FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


MySQL error 1604





jasperlevink
Hello Folks!

I get an error when I run the following query on a (not frihost) server. The quey seems right. De spare queries work and on another server a querie like this one does work.

SQL-query :

SELECT *
FROM supercategorie
WHERE supcatno
IN (

SELECT supcatno
FROM cat_supcat
WHERE catno =9
)
LIMIT 0 , 30

MySQL retourneerde:
#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 'SELECT supcatno
FROM cat_supcat
WHERE catno =9 ) LIMIT 0, 30' a

Greetingz
Jasper
nunosilva
I would say that the problem was with the "limit" predicate...
the limit predicate allows you limit the number of rows selected...
If I see, wouldn't you rather do
Code:

SELECT *
FROM supercategorie
WHERE supcatno
IN (

SELECT supcatno
FROM cat_supcat
WHERE catno =9
)
limit 30


for a display of 30 results max?
or you want to put a between predicate there?
something like "where catno between 0 and 30"??
ml
Quote:
SELECT *
FROM supercategorie
WHERE supcatno
IN (

SELECT supcatno
FROM cat_supcat
WHERE catno =9
)
limit 30


i think the problem is, that mysql simply doesn't know in.

try this:

Code:
SELECT *
FROM supercategorie
WHERE supcatno =
  (
  SELECT supcatno
  FROM cat_supcat
  WHERE catno =9
  )
limit 30


for further information read: http://dev.mysql.com/doc/refman/4.1/en/subqueries.html
Related topics
Mysql error!
[solved] Weird mysql error
Suppressing mysql error
[mySQL] Error I cannot Debug
MySql error: Column count doesn't match value count at row 1
Mysql Error
MySQL error
Error connecting to mysql ; please help
Mysql error: Warning: mysql_num_rows():
mysql error
MySQL error
Urgent! MySQL error!
MYSQL Ajax im Installation Error
Mysql ERROR
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.