Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
SQL
select Prod_Name from tbl_Product_Master where Prod_Name like 'm%'

select Prod_Name from tbl_Product_Master where Prod_Name not like 'm%'
Posted
Updated 31-Dec-12 23:00pm
v2

This is a fairly simple task.
Since the two Prod_Name values appear to be the same type, use the UNION[^] clause.

select Prod_Name from tbl_Product_Master where Prod_Name like 'm%' order by Prod_Name asc<br />
UNION<br />
select Prod_Name from tbl_Product_Master where Prod_Name not like 'm%'<br />


Note that this will remove all duplicate values.
 
Share this answer
 
There is a simpler way:
SQL
select Prod_Name from tbl_Product_Master where Prod_Name like 'm%' OR Prod_Name not like 'm%'

Which in this case is:
SQL
select Prod_Name from tbl_Product_Master
 
Share this answer
 
Comments
Shambhoo kumar 1-Jan-13 5:11am    
Thanks......
:)
OriginalGriff 1-Jan-13 5:13am    
You're welcome!
Shambhoo kumar 1-Jan-13 5:17am    
sir actually i want to apply order by clause on first select statement not on second statement ,but it's not working ,...so u help me plz...
i solve my self........
SQL
select Prod_Name from tbl_Product_Master where Prod_Name like 'm%'
union all
select Prod_Name from tbl_Product_Master where Prod_Name not like 'm%'
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900