Need help in a query
Hi,
I have a 2 tables
create table x (group_name varchar2(20),name varchar2(20));
create table y (name varchar2(20),price number);
Insert into x values ('computer','keyboard');
values ('computer','mouse');
values ('car','door');
values ('House','computer');
Insert into y values ('keyboard',20);
values ('mouse',30);
values ('door',40);
values ('computer',400);
i want keyboard and mouse from table 'y' if the entered value is 'computer'. But if the entered value is 'door' then i just need door from the table Y.
i wrote a query like this
select * from Y
where (((select 'Yes' from x
where name=:p_name) = 'Yes' and name =:p_name) or ((select 'Yes' from x