Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

T-SQL that works, but needs a facelift!

$
0
0

Techies--

This extracts what I need, but looks very late '80's. To make a long story short, I have table t1 with a real identifier I've dubbed as i . In table t2  I have comparable b,c values in both tables--although-- in different data types. I've made them uniform, then concatenated them together to pull back the subset I want. 

Is there a better way to do this?

select i,
          b,
          c
  from t1
   where ( cast(b as varchar(10)) + cast(c as varchar(10)) ) IN
     (select
         cast(bb as varchar(10)) + cast(cc as varchar(10))
        from t2
     )



Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>