423,109 Members | 2,122 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 423,109 IT Pros & Developers. It's quick & easy.

How to display 'Please select all' at top of Union Query results

P: 55
I have a dropdown list which has an sqldatasource but I'd like the first item on the list to be "Please Select A Title".I tried using a UNION query :

SELECT MessageTable.Title
FROM dbo.MessageTable
INNER JOIN dbo.PreacherTable
ON
dbo.PreacherTable.PreacherID=dbo.MessageTable.Prea cherID
WHERE dbo.PreacherTable.PreacherID=1
union select Upper('Please select A Title' )

But the result is:
7 People Who Believed In The Anointing - day 2 ses 1
7 Steps To The Anointing In Your Own Company - day 3 ses 1b
Anointing In Your Own Company - day 3 ses 1a
Iron Sharpeneth Iron Loyalty Conference 2009
PLEASE SELECT ALL
The Anointing In Your Own Company - day 3 ses 1a

How do I get the PLEASE SELECT ALL row to be first row in the resultset?

thanks
Jun 2 '10 #1

✓ answered by Uncle Dickie

You could try something like the following(I would guess that you can set your drop down to ignore the mySort field so it doesn't show on your form) :

Expand|Select|Wrap|Line Numbers
  1. SELECT MessageTable.Title,
  2.        2 AS mySort
  3. FROM dbo.MessageTable
  4. INNER JOIN dbo.PreacherTable
  5. ON
  6. dbo.PreacherTable.PreacherID=dbo.MessageTable.PreacherID
  7. WHERE dbo.PreacherTable.PreacherID=1
  8. UNION
  9. SELECT Upper('Please select A Title' ),
  10.        1
  11. ORDER BY mySort
  12.  

Share this Question
Share on Google+
1 Reply


Uncle Dickie
P: 67
You could try something like the following(I would guess that you can set your drop down to ignore the mySort field so it doesn't show on your form) :

Expand|Select|Wrap|Line Numbers
  1. SELECT MessageTable.Title,
  2.        2 AS mySort
  3. FROM dbo.MessageTable
  4. INNER JOIN dbo.PreacherTable
  5. ON
  6. dbo.PreacherTable.PreacherID=dbo.MessageTable.PreacherID
  7. WHERE dbo.PreacherTable.PreacherID=1
  8. UNION
  9. SELECT Upper('Please select A Title' ),
  10.        1
  11. ORDER BY mySort
  12.  
Jun 2 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.