Jump to content

Archived

This topic is now archived and is closed to further replies.

logu

problem in select

Recommended Posts


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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.