sql server - Alias names for columns when using TOP N query -


i have table named user_bills, containing 192 records, sorting every user respect phone_number. query returns columns in table:

select top 1 *    user_bills   phone_number = 4423568989 

... , actual column names follows:

phone_number|user_name|reciept_number 

however them be:

phone number|user name|reciept number 

i tried query below, i'm getting error missing keyword exist. there better option?

select top 1   (           select   phone_number 'phone number',                     user_name 'user name',                    usage_amount 'usage amount',                    charges 'charges',                     fine,                     month_for 'month',                    year,                    reciept               user_bills         )    user_bills  phone_number = 4423568989 

select top 1 phone_number 'phone number',               user_name 'user name',               usage_amount 'usage amount',               charges 'charges',               fine,               month_for 'month',               year,               reciept  user_bills  phone_number = 4423568989 

Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -