Filter or Nested Select statment?

  • LUMunicipality table consists of

    id, Name, Main fields

    Would like to further filter results from the following:

    Select LUMunicipality.Name AS Mun,COUNT(PROPERTIES.Municipality)total

    From LUMunicipality,PROPERTIES Where LUMunicipality.Name =

    PROPERTIES.Municipality Group By LUMunicipality.Name

    returns

    MUN total

    city1 17

    city2 1

    city3 1

    city4 34

    city5 15

    city6 16

    city7 18

    city8 20

    city9 27

    city10 1

    city11 5

    I need to further filter this result set based on a string value in the 'Main' field in the LUMunicipality table

    ie; where Main = 'a string value'

    appending HAVING will not work with strings..correct?

    Any direction would be appreciated. Thanks

  • I don't believe that you'd put that in the HAVING... why not just put it in the WHERE clause?

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply