SQL Query help needed
Posted by:
Shreya P
Date: April 22, 2016 01:03PM
Hello Everyone,
I have a requirement to match the data with combination of "equal to" and like operators.
Example Query:
select product_name, model from products where product_name = 'Air Conditioner' and
(CASE WHEN model = 'Blueline' THEN model = 'Blueline' ELSE model like 'Blueline%' END);
Model column in the products table has the model range for each product_name. In the above case for example
There model values like
Blueline
Blueline Premier
Blueline Super
Blueline Limited Edition
I want to my query to fetch only "Blueline" when the table has the data. If not then only it should apply model like 'Blueline%'
My query above returns all the rows. It is considering the value based on "equal to" first theen it is also fetching the values based on "like".
Is there any way I can restrict the "like" operator when the "equal to" (model = 'Blueline') data is found and fetched by the query.
Please help.
Thanks in advance.
Regards
Shreya P
Subject
Written By
Posted
SQL Query help needed
April 22, 2016 01:03PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.