0

I am getting the following error message when executing my query

[2/2] DBALException: An exception occurred while executing 'SELECT DISTINCT s0_.id AS id0, s0_. AS 1 FROM shop s0_ WHERE s0_.isLocked = ? ORDER BY s0_.owner_id DESC LIMIT 20 OFFSET 0' with params [0]:

SQLSTATE[42000]: Syntax error or access violation: 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 'AS 1 FROM shop s0_ WHERE s0_.isLocked = 0 ORDER BY s0_.owner_' at line 1   +

[1/2] PDOException: SQLSTATE[42000]: Syntax error or access violation: 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 'AS 1 FROM shop s0_ WHERE s0_.isLocked = 0 ORDER BY s0_.owner_' at line 1  

Is this supposed to be a query error or is this something else ? Because it seems that my query is legit.

2
  • 1
    s0_. AS 1 ?? where is field name Commented Oct 21, 2013 at 11:42
  • Perhaps you have forgotten to specify the column s0_ Commented Oct 21, 2013 at 11:43

2 Answers 2

1
SELECT DISTINCT s0_.id AS id0, s0_. AS 1

It is supposed to be a query error. You are selecting the unique id's from table s0_ and a field with no name of that same table, but a field can't have no name.

You should add a fieldname, like this:

SELECT DISTINCT s0_.id AS id0, s0_.FIELDNAME AS `1`
Sign up to request clarification or add additional context in comments.

Comments

0
SELECT DISTINCT s0_.id AS id0, s0_. AS `1`

wrap 1 in ``

And the missing field name from comments above...

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.