I am creating a database to store a wedding invite list. I am storing fname, lname, phone, street, city, state, zip.
Now i want to create a query that will return all the people in the list, i want to order it by people whos addresses are not in the database first in alphabetical order by last name, and then everyone who is in the the database with an address by alphabetical order by last name. Heres what i have so far:
SELECT fname, lname, phone, street
FROM tblGrooms
ORDER BY street, lname;
Now this will return exactly what i want, but it sorts the second half (the list of names that DO have addresses) by address NOT last name. How can i fix this?
Im sure this is a really simple fix and im just over looking it! Please help!
3 1622
This question has been posted in the Articles section and is being moved to the Access forum.
ADMIN
I am creating a database to store a wedding invite list. I am storing fname, lname, phone, street, city, state, zip.
Now i want to create a query that will return all the people in the list, i want to order it by people whos addresses are not in the database first in alphabetical order by last name, and then everyone who is in the the database with an address by alphabetical order by last name. Heres what i have so far:
SELECT fname, lname, phone, street
FROM tblGrooms
ORDER BY street, lname;
Now this will return exactly what i want, but it sorts the second half (the list of names that DO have addresses) by address NOT last name. How can i fix this?
Im sure this is a really simple fix and im just over looking it! Please help!
You could experiment with a UNION Query, something along the lines of: - SELECT tblEmployee.LastName, tblEmployee.FirstName, tblEmployee.PhoneNumber, tblEmployee.Address
-
FROM tblEmployee
-
WHERE tblEmployee.Address Is Null
-
UNION SELECT tblEmployee.LastName, tblEmployee.FirstName, tblEmployee.PhoneNumber, tblEmployee.Address
-
FROM tblEmployee
-
WHERE tblEmployee.Address Is Not Null
-
ORDER BY tblEmployee.LastName;
NeoPa 32,556
Expert Mod 16PB
I am creating a database to store a wedding invite list. I am storing fname, lname, phone, street, city, state, zip.
Now i want to create a query that will return all the people in the list, i want to order it by people whos addresses are not in the database first in alphabetical order by last name, and then everyone who is in the the database with an address by alphabetical order by last name. Heres what i have so far: - SELECT fname, lname, phone, street
-
FROM tblGrooms
-
ORDER BY street, lname;
Now this will return exactly what i want, but it sorts the second half (the list of names that DO have addresses) by address NOT last name. How can i fix this?
Im sure this is a really simple fix and im just over looking it! Please help!
You've only told us half the story.
How can you sort by the last name if the entry doesn't even exist in the database?
If you can express the question accurately, then I'm sure someone can help you with an answer. I suspect it won't be as complicated as using a UNION query in this case, but we can only guess if you don't share the question with us.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: ASobol |
last post by:
//code.begin()
#include <iostream>
int g (int i)
{
static const int j = i;
return j;
}
int main (int, char**)
|
by: publictom |
last post by:
Is the following statement true?
"It is required that the operands to an operator be fully evaluated
before the operator itself is evaluated."
The only way I can think of that it would be...
|
by: Greg Strong |
last post by:
Hello All,
Is the only solution to an update query which requires the records in a
certain order to dump the records into a temp table in the required
order, then do the update query?
I've...
|
by: sahukar praveen |
last post by:
Hello,
I have a question.
I try to print a ascii file in reverse order( bottom-top). Here is the logic.
1. Go to the botton of the file fseek(). move one character back to avoid the EOF.
2....
|
by: Mike Nolan |
last post by:
I'm trying to create a summary log by hour. Here's the query (somewhat
simplified):
select to_char(mtrantime,'mm-dd hh AM') as datetime,
count(*) as tot from memtran
group by datetime
order...
|
by: John Smith |
last post by:
I've been playing with splint, which returns the following
warning for the code below:
statlib.c: (in function log_norm_pdf)
statlib.c(1054,31): Expression has undefined behavior (left
operand...
|
by: ibiza |
last post by:
Hi all,
I use VB.NET (C# would do the same) and GDI+ to draw on a form. I'd
like to know if it is possible to set the z-order when we draw
something...Let's consider that simplified case :
'...
|
by: Rasjid |
last post by:
Hello,
I have just joined and this is my first post.
I have never been able to resolve the issue of order of evaluation in
C/C++ and the related issue of precedence of operators, use of...
|
by: EzeeGoN |
last post by:
Using Flash8 Actionscript 2.0
i am looking for a method to generate sequential numbers in a random order (not using the same number twice) can anyone help please?
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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...
|
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |