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

Filter rows based on Where condition AND-OR ?

$
0
0

Hi,

I have table "Table1" and columns are

Id

AddendumNo

 

ClaimNo

 

Description

1

A1

C1

D1

2

A1

C1

D2

3

A1

C2

D1

4

A2

C3

D3

5

A2

C1

D2

I have three controls in the UI.

If I give txtA1.Text =”A1” only then should be return Id- 1,2,3 records.

If I give txtC1.Text =”C1” only then should be return Id- 1,2,5 records.

If I give txtA1.Text =”A1” AND txtC1.Text =”C1” then should be return Id- 1,2 records.

If I give give txtA1.Text =”A1” AND txtC1.Text =”C1” AND txtD1.Text=”D1” then should be return Id-1 record.

Please help me to write dynamic sql query ?

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>