473,416 Members | 1,683 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

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

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.  

1 1666
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

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

Similar topics

3
by: Paradigm | last post by:
I am using Access 2K as a front end to a MYSQL database. I am trying to run a Union query on the MYSQL database. The query is (much simplified) SELECT as ID from faxdata UNION SELECT as ID ...
2
by: M Stery | last post by:
Have two base queries used for mailing labels with id,name,address,city,state,zip that are combined via a union query. One base query uses home address; the other base query uses biz address. I...
2
by: mattytee123 | last post by:
I have about 20 tables, of which I would like to do a union query and count of how many of each different code there is? The simplified verson of the table is structured like this. Code ...
3
by: NoodNutt | last post by:
G'day ppl. Can anyone assist me with the correct structure of the following in a Union Query. tblBookings.FinYear tblBookings.DepPrefPay tblBookings.IntPrefPay tblBookingsFinPrefPay
4
by: spam | last post by:
If I run the following query in Access 2002 then I get the expected result: SELECT * FROM CSVImport UNION SELECT * FROM AssetTemp; I get the contents of both tables with no duplicates. If I...
1
by: forey | last post by:
Hi All, I'm trying to find the best way to accomplish the following: I have a union query in an Access XP database (pasted below) SELECT Contacts.Company,Contacts.dba, Contacts.Misc1,...
5
by: BillCo | last post by:
I'm having a problem with a union query, two simple queries joined with a union statement. It's created in code based on parameters. Users were noticing some inconsistant data and when I analysed...
1
by: bgreenspan | last post by:
Hi Everyone, I'm back for some more expert help. Here's what I am doing and what I tried. My database has entries with Contract Names and Expiry Dates, among other fields. I have a form...
27
by: MLH | last post by:
How can I turn the following into a make-table query? SELECT & " " & AS Recipient FROM tblVehicleJobs INNER JOIN tblAddnlOwnrs ON tblVehicleJobs.VehicleJobID = tblAddnlOwnrs.VehicleJobID WHERE...
2
by: billelev | last post by:
Hi There, I am performing a UNION query on a Table containing % formatted values with a Query, also containing % formatted values. The resulting union query displays the table % values as...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.