SQL question

Miscellaneous Forums/General Discussion/SQL question

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Not sure what DBMS you want it in and exactly what your table structure is but adapt something like this:
Select
    *
From
    Player as P
Where
    (P.ClubId, P.SquadNumber) in
(   Select
        D.ClubId
       ,D.SquadNumber
    From
        Player as D
    Group by
        D.ClubId
       ,D.SquadNumber
    Having
        count(*) > 1
)
Order by
    P.ClubId
   ,P.SquadNumber
   ,P.Id
;


The 'inner' query returns the ClubId, SquadNumber pairs that have more than one occurrence in the Player table.

The 'outer' query then selects the rows that have those values so you can see the player ids and everything else.