Hi all,
I would like to limit a field using a where clause then use a wildcard
search to further limit the values.
For instance using PUBS:
SELECT *
FROM authors
WHERE (au_fname IN (LIKE ‘ Jo % ’, LIKE ‘ Bill % ’))
In other words allowing me to choose a wildcard from a subset of the original.
Any ideas? Most grateful.
Sam
SELECT au_fname
FROM authors
WHERE au_fname LIKE 'Jo %'
OR au_fname LIKE 'Bill %'
or:
SELECT au_fname
FROM authors,
(SELECT 'Jo %' UNION ALL
SELECT 'Bill %') AS T(fname)
WHERE au_fname LIKE T.fname
David Portas
SQL Server MVP
|||Hi Sam,
The WHERE clause with a condition is used to filter the rows from a given
table. Just using WHERE clause doesn't limit the field (as mentioned by you).
I guess you are looking at something like this:
SELECT *
FROM authors
WHERE (au_fname LIKE 'Jo%' OR au_fname LIKE 'Bill%')
Thanks
Yogish
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment