silverkid
silverkid

Reputation: 9573

sql query to show all records except for certain records

i have an ms-access table

TableA

MSN   PR
11    -
13    A
12    Dead
14    B
15    C

How can i write an sql query to remove records in "-" and "Dead" occurances in PR collumn. so that query result should be

MSN  PR
13   A
14   B
15   C

any help appreciated

Upvotes: 0

Views: 4018

Answers (3)

onedaywhen
onedaywhen

Reputation: 57023

The answer essentially is 'create a search condition by adding a WHERE clause to your query' i.e. you clearly know next to nothing about SQL so an online tutorial aimed a beginners would be more appropriate than a Q&A site.

Upvotes: 0

Steve De Caux
Steve De Caux

Reputation: 1779

select msn, pr from tableA where pr not in ('_', 'Dead')

Upvotes: 1

Andomar
Andomar

Reputation: 238086

To exclude the rows from a selection:

select *
from TableA
where PR not in ('-','Dead')

Or to permanently remove them:

delete
from TableA
where PR not in ('-','Dead')

Upvotes: 4

Related Questions