user3231448
user3231448

Reputation: 1

need some help from count query

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

Answers (2)

ipet
ipet

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

Axel Amthor
Axel Amthor

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

Related Questions