Solved

Return multiple values in select union query....

Posted on 2006-07-05
3
225 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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

730 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