I have the table below :
Desk_name | head
ali | john
cars ln | max
pol fr | max
jus | john
I want to create a stored procedure in order to have in return :
Name | sector_head
ali mm | john
cars ln | max
pol fr | max
jus mm | john
As you can see the column name has changed (from ‘Name’ to ‘Desk_name’) and every name in the ‘Name’ column has the abbreviation “mm” at the end of each values if it is a single word (ali and jus).
How can I do such a stored procedure (i am using sql server)?
Thanks
You need to supply
ALIASon it, exampleSQLFiddle Demo