Çoğaltır SQL DISTINCT Count

0 Cevap php

I am doing a query on a mysql database. I have a main table where users are stored and another table where friends of that user are stored. For each user I want to see how many friends they have. This is what I'm getting.

ID    FirstName LastName FriendID
1     Andrew    Smith     1
1     Andrew    Smith     5
1     Andrew    Smith     9
2     John      Doe       3
2     John      Doe       5

Bu benim almak istiyorum budur.

ID    FirstName LastName Friends
1     Andrew    Smith     3
2     John      Doe       2

Bu bana bildirin gitmek için yeterli ayrıntı değildir ve eğer ben de tabloları gösterir ve ben kullanılan sorgular.

0 Cevap