logu Posted September 13, 2006 Share Posted September 13, 2006 Hai, I am having two tables "user" and "loan" user can have n number of loans . what i want is to select the user who has more than five records in loan table. is it possible ? thanks in advance Link to comment https://forums.phpfreaks.com/topic/20614-problem-in-select/ Share on other sites More sharing options...
fenway Posted September 13, 2006 Share Posted September 13, 2006 Just a wild guess, based on arbitrary field names:SELECT username, COUNT(*) AS cnt FROM user INNER JOIN loan ON ( user.uid = loan.user_uid ) GROUP BY user.uid HAVING cnt >= 5 Link to comment https://forums.phpfreaks.com/topic/20614-problem-in-select/#findComment-91107 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.