0

I have a SQL query as follows

SELECT * FROM epf_application WHERE application_id IN
(SELECT application_id FROM epf_application_device_type WHERE device_type_id IN
(SELECT device_type_id FROM epf_device_type WHERE name="someDevice") LIMIT 30) LIMIT 30

When I run it in phpMyAdmin, I get the following error

1235 - This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'

From the error, I am guessing that there is a problem with placing LIMIT in a subquery. Any suggestions on how I can fix this?

4
  • As the error says, that feature apparently isn't yet supported. You may need to get your hands dirty and use a temporary table or something. Commented Jun 23, 2011 at 15:11
  • Nested SQL queries are also bad on performance. FYI Commented Jun 23, 2011 at 15:12
  • @FinalForm: Indeed, I think David needs to learn a bit about JOINS. Commented Jun 23, 2011 at 15:14
  • @josh.trow Thanks for the tip. I'll learn JOINS Commented Jun 23, 2011 at 20:26

1 Answer 1

1
SELECT 
 ea.* 
FROM 
 epf_application ea JOIN epf_application_device ead 
  ON ead.application_id = ea.application_id 
 JOIN epf_device_type edt 
  ON edt.device_type_id = ead.device_type_id 
WHERE 
 edt.name = 'someDevice' 
LIMIT 30
Sign up to request clarification or add additional context in comments.

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.