Reputation: 1
I have a table called
tb_applicants
with fields id
, aic
, name
app_interview
with fields id
, atic
, atname
My problem is i want to count all (atic
) from app_interview
table where atic
is equal to aic
from table (tb_applicants
) group by 1(aic
) from tb_applicants
In my current query its not working can anyone help me find where is the problem it gives me 0 count all the time.
query:
SELECT count(t.atic)
FROM app_interview as t
INNER JOIN tb_applicants as t2
WHERE t.atic = t2.aic
GROUP BY t2.aic;
Upvotes: 0
Views: 37
Reputation: 161
Remove the ;
and use ON
for JOINS:
SELECT count(*) FROM app_interview INNER JOIN tb_applicants ON tb_applicants.aic = app_interview.atic GROUP BY tb_applicants.aic;
Upvotes: 2
Reputation: 11096
Could probably done simpler, since you need only matching rows:
SELECT count(t.atic)
FROM app_interview as t, tb_applicants as t2
WHERE t.atic = t2.aic
GROUP BY t.atic;
Upvotes: 0