CREATE TEMPORARY TABLE tbl_Stock (
Id int ,
Name varchar(99),
Type varchar(25),
Price NUMERIC(8,2)
);
INSERT INTO tbl_Stock (Id ,Name , Type ,Price)
VALUES (1 ,'TCS' ,'C1' ,2222.25);
INSERT INTO tbl_Stock (Id ,Name , Type ,Price)
VALUES (2 ,'SBIN' ,'B1' ,400.50);
INSERT INTO tbl_Stock (Id ,Name , Type ,Price)
VALUES (3 ,'INFY' ,'B1' ,1350.50);
INSERT INTO tbl_Stock (Id ,Name , Type ,Price)
VALUES (4 ,'RELIANCE' ,'A1' ,1950.50);
INSERT INTO tbl_Stock (Id ,Name , Type ,Price)
VALUES (5 ,'RELAXO' ,'A1' ,1190.50);
SELECT * FROM tbl_Stock ts ORDER BY CASE Type WHEN 'C1' THEN 1
WHEN 'A1' THEN 2
ELSE 3
END ASC;