hi
i want fillter A to K at ename in emp table
how is possible
hi
i want fillter A to K at ename in emp table
how is possible
First create a table and insert letter into that table as follows
create table test(let char(1))
insert into test_let values('A')
insert into test_let values('B')
insert into test_let values('C')
insert into test_let values('D')
insert into test_let values('E')
insert into test_let values('F')
then write this simple query to get the result
select a.ename,a.job,a.sal
from emp a, test b
where ename like b.let||'%'
Last edited by krishnaindia2007; 05-14-2008 at 11:23 PM.
The following query works only if you are using oracle 9i or above version.
With test as
( select 'a' let from dual
union all
select 'b' let from dual
union all
select 'c' let from dual
union all
select 'e' let from dual
union all
select 'f' let from dual )
select a.ename,a.job,a.sal
from emp a , test b
where ename like b.let||'%';
can i use this method
select * from emp where ename between 'A' and 'M'
or
select * from emp where ename between 'A' and 'L'
union all
select * from emp where ename like 'L%'
or
select * from emp where ename > 'L'
union all
select * from emp where ename like 'L%'
>>select * from emp where ename between 'A' and 'M'
Add substr function to the above query as follows
select * from emp
where substr(ename,1,1) between 'A' and 'M'
Generally between operator is used with numeric and date data types not with character data types.