Jump to content

[SOLVED] sub query syntax error!


Adam

Recommended Posts

Hi guys.

 

MySQL is certainly not my strongest point! I have a problem in the syntax of this query:

 

delete from auth_user_temp aut
where aut.user_id in (
    select user_id from user_group
    where (userclass_id = 25 or userclass_id = 6)
    group by user_id
    having count(userclass_id) = 2
);

 

Basically the sub query returns records that have the userclass_id of 25 or 2, nothing else, and no less. The select sub query works fine by itself. I think the problem is using "aut.user_id in ..."

 

Does any body have an alternative or, perhaps be able to tell me why it's not working?

 

Thanks!

Adam

 

 

Link to comment
https://forums.phpfreaks.com/topic/149623-solved-sub-query-syntax-error/
Share on other sites

It's the same?

 

delete from auth_user_temp aut
where aut.user_id in (
    select user_id from user_group
    where (userclass_id = 25 or userclass_id = 6)
    group by user_id
    having count(userclass_id) = 2
);

 

Returns:

 

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 'where aut.user_id in (

    select user_id from user_group

    where (userclass_i' at line 2

 

Cheers,

Adam

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.