sql - Match Two Select Statements for Comparison -


i have 2 sql views following select statements:

1.

 select substring(updatedcolumn,3, 9) [partialsearch] [database_name].[dbo].[table] 

2.

select substring(oldcolumn,3, 9) [partialsearchonlivetable] [same_database_name].[dbo].[differenttable] 

both these views return 1 column respectively. want compare values in first view against values in second view , return updatedcolumn data match not found.

i have considered using comparison operators can't seem want since according logic, have specify conditional checking of views against each other in clause , sql not permit that. also, union/union give me result set of records. don't want.

lastly, had @ combine 2 select statements date comparison , not i'm looking for.

practically, view 1 returns :

abcxxxxxx dokjfhxxx cmodxxxxx wuysxxxxx aaallooxx 

view 2 returns:

xdsffsafa xxxxhjsks ajdhxxxxx cmodxxxxx xxxxxx12s skskshdki aaallooxx 

from output see there 2 matches. of

aaallooxx cmodxxxxx 

that's output looking for. suggestions?

you can use intersect, set operator between 2 queries. prints common rows present in 2 queries.

select substring(oldcolumn,3, 9) [partialsearchonlivetable] [same_database_name].[dbo].[differenttable] intersect --set operation between 2 queries select substring(updatedcolumn,3, 9) [partialsearch] [database_name].[dbo].[table] 

Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -