Test: Location Somewhere

1

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

-- List of Users in a given location
-- Not Case Sensitive

SELECT
    Top ##Top##
    ROW_NUMBER() OVER(ORDER BY Reputation DESC) AS [#], 
    Id AS [User Link], 
    Reputation,
    Location,
    --CreationDate,
    LastAccessDate,
    UpVotes,
    DownVotes
    
FROM
    Users
WHERE

    (
    lower(location) like lower('%##location##%')

  -- For the abbreviation right side match, lead with a space
  -- Enter dummy if not required
  or lower(location) like lower('%##AbbreviationRight##')
     )
  
  -- exclusions
     and not
     (
     -- Enter dummy if not required
     lower(location) LIKE lower('%##Exclusion##%')
     or lower(location) LIKE lower('%europe%')
     or lower(location) LIKE lower('%India%')
     or lower(location) LIKE lower('%london%')
     or lower(location) LIKE lower('%spain%')
     or lower(location) LIKE lower('%Universe%')
     or lower(location) LIKE lower('% UK%')
     or lower(location) LIKE lower('%USA%')
     
     or lower(location) LIKE lower('%Universe%')
     or lower(location) LIKE lower('%Universe%')
     or lower(location) LIKE lower('%Universe%')
     )
 order by location asc -- to pick out incorrect results

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results