sql server - Determining if one row's column equals another row's column -



sql server - Determining if one row's column equals another row's column -

hello table this:

id | name | description | location | effec_dte ---------------------------------------------- 1 | serv | ohcod01 | nyny | 2014-1-1 2 | serv | ohcod01 | cala | 2014-1-1 3 | serv | ohcoa11 | scco | 2014-5-1 4 | serv | ohcoa11 | scco | 2014-5-1 ...

in illustration there 2 applications, 1 hosted in new york , la other hosted in columbia. want find each application , check first , sec row determine if in same city or hosted in 2 different cities.

is there way this?

thanks!

edit:

select name table (//logic find names exist in 2 locations)

belong 2 or more different cities

with cte ( select *, row_number() over(partition location order id ) row mytable ) cte.row>1

belong 1 cities

with cte ( select *, row_number() over(partition location order id ) row mytable ) cte.row=1

sql-server

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -