Include a blank row in query results

前端 未结 3 1917
忘了有多久
忘了有多久 2021-01-25 05:44

Is there a way to include a blank row at the top of a sql query, eg if it is meant for a dropdown list? (MS Sql Server 2005 or 2008)

Select * 
  FROM datStatus          


        
3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-25 06:06

    I feel it's nicer to do it outside SQL, but if you insist...

    SELECT -1, '(please choose one)'
    UNION
    SELECT * FROM datStatus
    ORDER BY statusName
    

提交回复
热议问题