View previous topic :: View next topic
|
Author |
Message |
Naresh Dasari
New User
Joined: 16 Oct 2007 Posts: 9 Location: Chennai
|
|
|
|
Hi,
We usually give the query like the following to get the records where lastname starts with 'S'
SELECT EMPNO, LASTNAME FROM EMPLOYEES
WHERE LASTNAME LIKE 'S%'
Now, I want to acces the records where the lastname starts with '%'.
Can anyone help me hw to write a query. |
|
Back to top |
|
|
kapil.ksingh
New User
Joined: 21 May 2008 Posts: 1 Location: India
|
|
|
|
Hi,
As far as I am concern it may be like below ----
select empno,lastname from employees
where lastname like
SELECT * FROM EMP_MASTER
WHERE SUBSTR(ENAME,1,1) = '%'; |
|
Back to top |
|
|
ascelepius
New User
Joined: 16 Jun 2008 Posts: 35 Location: bangalore
|
|
|
|
A quick look into the DB2 manuals helped recall the escape character,
you can use the query,
Code: |
SELECT EMPNO, LASTNAME FROM EMPLOYEES
WHERE LASTNAME LIKE '+%%' ESCAPE '+'
|
Thanks!
asci(i) |
|
Back to top |
|
|
|