What’s wrong with this mysql query :
select *
from tpa as t1
where ( select count(*)
from tpa as t2
where t1.id = t2.id )
error :
Error Code: 1054. Unknown column 't1.id' in 'field list'
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I think, as Cfreak pointed out in comment, that the alias is not visible in the subquery.
I think also that you forgot to specify some condition for your
count(*)result to be equal to some-number (or other condition):Change “= 1” with any numery condition you like, or this would be a silly way to rewrite this much simpler query:
🙂