SQL Language (MOSC)

MOSC Banner

Need help with a query

edited Feb 9, 2017 9:28AM in SQL Language (MOSC) 6 commentsAnswered

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

Tagged:

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center