stored procedures - Comparing multiple row and columns in sql server -


i had 2 tables first 1 real table second 1 temporary. had compare 2 table . first table had 'kartelakod' field should match temp's 'kartelakodu' field, first's 'ozellikkod' field should match temp's 'ozellikkodu',first's 'altkod' field should match temp's 'stokkodu'. tables

finally if doesn't match should return ''.

ps: should have group first table according vrturunkod. in example if mam|002's (which vrturunkod) ozellikkod field doesn't match temp table's ozellikkodu field, should vrturunkod record.

edit1:isnull((select top 1 vrturunkod konfigolusmusozellikler k sirket_kod = @sp_sirket_kod , anaurunkod = @spstokkod , exists(select * #tempdegisen t t.kartelakodu = k.kartelakodu , t.ozellikkodu = k.ozellikkod , t.stokkodu = k.altkod)),'') written far can ignore sirket_kod field , parameter.

this should produce list of rows there k no matching t, , @ no matching k. if no rows result, rows matched:

select *     konfigolusmusozellikler k   full outer join   #tempdegisen t   on      t.kartelakodu = k.kartelakodu ,      t.ozellikkodu = k.ozellikkod ,      t.stokkodu = k.altkod  t.kartelakodu null or k.kartelakodu null 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -