Unable To Fetch proper records kindly help

"select * from excel_prd where prd_thic is not null and prd_thic='0.160' or prd_thic='0.160' or prd_thic='0.180' and prd_tem='DR8' order by prd_thic"

Above Is my query.
Below Is my Out put.
prd_id prd_name prd_ql prd_thic prd_wi prd_le prd_tem prd_cot prd_fin prd_net prd_st
34 Tinplate Coils Prime 0.160 860 Coil DR8 28056 Stone 24.419 Ex Stock
35 Tinplate Coils Prime 0.160 860 Coil DR8 40020 Stone 8.183 Ex Stock
36 Tinplate Coils Prime 0.160 868 Coil DR7.5 20040 Stone 1.81 Ex Stock
75 Tinplate Coils Seconds 0.160 837 Coil DR8 28056 Stone 5.83 Ex Stock

if you see column "prd_le" want only 'DR8' records but 'DR7.5' is also showing.
KIndly Help.

I'm not 100% clear on what you'd want your final output to be, but what you need is to use some parenthesis to separate the logic in your WHERE clause.

SELECT	P.*
FROM	excel_prd AS P
WHERE	P.prd_tem = 'DR8'
		AND (P.prd_thic = '0.160' OR P.prd_thic = '0.180')
1 Like

thank you very much for your answer Sir.
As i wanted to fetch results only for 'DR8'
which is been achieved by your given query

thanking you once again

Always use parenthesis for OR criteria. That way you will not forget them.

i will keep this in my mind and give my self a practice :relieved: