Forum Discussion
Nkhatiwada
Sep 16, 2020Copper Contributor
SQL or Access query code for filtering the data
Can anyone help me, please. I need immediate help with SQL or Access query codes to show the values in my resultant table below. Thank you in advance.
For an example:
I have table1
| ID | Type | Material |
| 1 | ECNC | STL |
| 2 | EFCL | LED |
| 3 | EFCL | OHL |
| 4 | EFCL | STV |
| 5 | EFCL | STL |
| 6 | EFCL | NLU |
| 7 | ESIC | STV |
I want to see only these in my result
| ID | Type | Material |
| 1 | ECNC | STL |
| 3 | EFCL | OHL |
| 6 | EFCL | NLU |
| 7 | ESIC | STV |
Nkhatiwada You could use this query:
SELECT *
FROM Material
WHERE Type <> 'EFCL' OR (Type = 'EFCL' AND Material NOT IN('STL', 'STV', 'LED'))I took "Material" as table name, you can replace it with your table name.
Best wishes,
Tieme
3 Replies
- NkhatiwadaCopper ContributorI want to hide only STL, STV or LED materials that are EFCL types.
- WoldmanIron Contributor
Nkhatiwada You could use this query:
SELECT *
FROM Material
WHERE Type <> 'EFCL' OR (Type = 'EFCL' AND Material NOT IN('STL', 'STV', 'LED'))I took "Material" as table name, you can replace it with your table name.
Best wishes,
Tieme
- NkhatiwadaCopper Contributor
Thank you Woldman
This worked! I appreciate your help !