SQL help please. Thanks.?

Hi, I have the query

select distinct programcode, dept from studentaffairsview where termcode = ‘200900′;

I want to only show results where the programcode appears more than once. Can this be done?
Thanks

This’ll do it.

Select Count(programcode) as Instances, programcode from studentaffairsview
Where termcode = ‘200900′
Group by programcode
Having Count(programcode) > 1

One Response to “SQL help please. Thanks.?”

  1. This’ll do it.

    Select Count(programcode) as Instances, programcode from studentaffairsview
    Where termcode = ‘200900′
    Group by programcode
    Having Count(programcode) > 1
    References :

Leave a Reply