phpMYADMIN代码来计算行数

时间:2014-02-12 23:51:03

标签: mysql sql

有人能帮助我吗?我有两个表,我会计算出现在10“event_id”列中的行。

我有这段代码,但不起作用......

SELECT COUNT(event_id) FROM wp_leagueengine_season_matches_events, wp_leagueengine_tournament_matches_attributes WHERE event_id = '10'

感谢您的关注

1 个答案:

答案 0 :(得分:2)

我们试试这个

SELECT COUNT(wpe.event_id) as nr_wpe, COUNT(wpa.event_id) as nr_wpa  
FROM wp_leagueengine_season_matches_events wpe
INNER JOIN wp_leagueengine_tournament_matches_attributes wpa
    ON nr=nr_wpe+nr_wpa
WHERE event_id = 10