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

Please tel me which one is good approach of joining.

$
0
0

Dear all, 

Table_2 has following data

c             na

----------------

7.000k
3.000j
32.000g

Table_1 has following data

c             na

----------------

1.000l
2.000m
34.000h

na is primary key for both tables.

i want only h and g should come in one row

select * from [Table_2] a CROSS JOIN table_1 b 
where a.na='g' and b.na='h'

and a.c> b.c

select * from [Table_2] a inner JOIN table_1 b 
on a.na='g' and b.na='h'

and a.c> b.c

select * from [Table_2] a , table_1 b 
where a.na='g' and b.na='h'

and a.c> b.c

please tel me which one i should follow,

as i can see  na is primary key so there can be other better methods also

please suggest.

yours sincerly

    


Viewing all articles
Browse latest Browse all 23857

Trending Articles



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