Solved

Return multiple values in select union query....

Posted on 2006-07-05
3
221 Views
Last Modified: 2012-08-14
I have the following line (followed by many similar), but I want to return not only the missing field and the Account Title, but also the account number...what do I need to change to return (Account#) for the query??

Current: select "Account" as MissingField, [AccountTitle] from [RIA Accounts] where IsNull([Account]) UNION ....etc...
0
Comment
Question by:m7johnson
  • 2
3 Comments
 
LVL 65

Accepted Solution

by:
rockiroads earned 50 total points
ID: 17046281
just add it into your query

select [Account#] , [AccountTitle] from [RIA Accounts] where IsNull([Account])


now remember, all queries in your union statement must return the same number of columns
so since this is in the first column, if subsequent queries dont have it, add in the missing column, like u did

select [Account#] , [AccountTitle] from [RIA Accounts] where IsNull([Account])
union
select '' as something, ...

0
 

Author Comment

by:m7johnson
ID: 17046312
i thought i had tried that already, I kept thinking "why is this not working".......regardless thanks
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 17046317
no probs
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now