SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Other Forums
 SQL Server 6.5 \ SQL Server 7.0
 add item manually to a select distinct statement
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

BillEdd
Starting Member

8 Posts

Posted - 09/28/2011 :  09:46:13  Show Profile  Reply with Quote
I need to add an item manually to the results of a select distinct statement. My statement is:

select distinct Region from mytable order by Region

This returns:
East
North
South
West

I need to return:
Select a region
East
North
South
West

This is populating a drop down on a web site and I want "Select a region" as the first item before the regions appear

TIA

Bill

webfred
Flowing Fount of Yak Knowledge

Germany
8766 Posts

Posted - 09/28/2011 :  09:54:48  Show Profile  Visit webfred's Homepage  Reply with Quote
select ' Select a region' as Region
union all
select distinct Region from mytable order by Region




No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

webfred
Flowing Fount of Yak Knowledge

Germany
8766 Posts

Posted - 09/28/2011 :  09:56:14  Show Profile  Visit webfred's Homepage  Reply with Quote
Have a look: there is a space to get the ' Select a region' in top position...


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000