Page 1 of 1

Whats wrong with this SQL?

Posted: Thu Nov 24, 2005 10:36 am
by JayBird
Okay,

This SQL query causes the server to crash...tried it on 3 different servers, all with the same effect.

Code: Select all

SELECT `q`.`id` as `mainID`, `q`.`qgid`, `q`.`section`, `q`.`fieldType`, `a`.`qid`, `a`.`uid`, `a`.`answer` as `mainAnswer`, `sa`.`id`, `sa`.`answer`

FROM `gradlife_co_uk_-_gradlife`.`questions` as `q`, `gradlife_co_uk_-_gradlife`.`answers` as `a`, `gradlife_co_uk_-_gradlife`.`setanswers` as `sa`

INNER JOIN `gradlife_co_uk_-_gradlife`.`answers` ON `q`.`id` = `a`.`qid`

GROUP BY `q`.`id`, `a`.`uid` ORDER BY `a`.`uid`

Any ideas?

Posted: Thu Nov 24, 2005 10:40 am
by neophyte
I've never seen this sort of syntax before:

`alias`.`name`

Get rid of all back ticks and try just:

alias.name

That's what I'd change.

Posted: Thu Nov 24, 2005 10:44 am
by JayBird
backticks are perfectly acceptable in queries...infact my host requires that queries are structured like this

Re: Whats wrong with this SQL?

Posted: Thu Nov 24, 2005 10:45 am
by Weirdan
Pimptastic wrote:Okay,

This SQL query causes the server to crash...tried it on 3 different servers, all with the same effect.
what do mysql server's error logs say then?

Posted: Thu Nov 24, 2005 10:52 am
by JayBird
Nothing at all useful

Code: Select all

051124 16:31:47	      1 Query       SELECT `q`.`id` as `mainID`, `q`.`qgid`, `q`.`section`, `q`.`fieldType`, `a`.`qid`, `a`.`uid`, `a`.`answer` as `mainAnswer`, `sa`.`id`, `sa`.`answer`

FROM `gradlife_co_uk_-_gradlife`.`questions` as `q`, `gradlife_co_uk_-_gradlife`.`answers` as `a`, `gradlife_co_uk_-_gradlife`.`setanswers` as `sa`

INNER JOIN `gradlife_co_uk_-_gradlife`.`answers` ON `q`.`id` = `a`.`qid`

GROUP BY `q`.`id`, `a`.`uid` ORDER BY `a`.`uid`
C:\Program Files\MySQL\MySQL Server 4.1\bin\mysqld-nt, Version: 4.1.10-nt-log. started with:
TCP Port: 3306, Named Pipe: MySQL

Re: Whats wrong with this SQL?

Posted: Fri Nov 25, 2005 12:00 am
by n00b Saibot
Pimptastic wrote:Any ideas?
No ideas... my brain crashed while reading it 8O