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

select Query where multiple column in multiple values (cant use in clause)

$
0
0

I can use (in clause) with on column like this:

Select code from table where code in(1,2,3)

-------------------------------My case:-------------------------------------------------

I’ve 4 columns PK of table as below 

I need to :

selectwhere (code, month, year) in ((1,1,2013) and (2,1,2014) and (2,2,2015))

i can't write it this way :

select where code in (1,2) and month in (1,2) and year in (2013,2014,2015)

case i'll get my rows but others included like (1,1,2015) , (1,1,2014),(2,1,2013) .. etc

I’m terribly want to solve this problem

Please help me

Code (pk)

Month (pk)

Year (pk)

emp_code(pk)

1

1

2013

101

1

1

2013

102

2

1

2013

101

2

1

2013

102

1

2

2013

101

1

2

2013

102

2

2

2013

101

2

2

2013

102

1

1

2014

101

1

1

2014

102

2

1

2014

101

2

1

2014

102

1

2

2014

101

1

2

2014

102

2

2

2014

101

2

2

2014

102

1

1

2015

101

1

1

2015

102

2

1

2015

101

2

1

2015

102

1

2

2015

101

1

2

2015

102

2

2

2015

101

2

2

2015

102


thank you





Viewing all articles
Browse latest Browse all 23857

Trending Articles



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