dadada
dadada

Reputation: 17

how to count in one table and get record from another table

I need help with the following query i have 2 tables first one location with primary key no_location and one of the entry no_membre and second table membre with no_membre as primary key and entries prenom_membre and nom_membre I need to know how to get prenom_membre and nom_membre of members that did more than 25 location. thank you in advance

Upvotes: 2

Views: 31

Answers (1)

Ferdinand Gaspar
Ferdinand Gaspar

Reputation: 2073

use HAVING clause to determine the result set to have more than 25 locations.

   SELECT prenom_membre,
           nom_membre,
           COUNT(no_location)
      FROM membre m
      JOIN location l
        ON m.no_membre = l.no_membre
     GROUP BY prenom_membre,
              nom_membre
    HAVING COUNT(no_location) > 25

Upvotes: 1

Related Questions