PMJI?? What does this mean?
Also I have created teh following SQL to be added into my
current SQL...
SELECT [SIMS/USER/E-Mail Passwords].[User Name],
[SIMS/USER/E-Mail Passwords].Password,
[SIMS/USER/E-Mail Passwords].[E-Mail Password],
[SIMS/USER/E-Mail Passwords].[SIMS ID],
[SIMS/USER/E-Mail Passwords].[SIMS Password],
[SIMS/USER/E-Mail Passwords].[Current User],
[SIMS/USER/E-Mail Passwords].[E-Mail Address],
[SIMS/USER/E-Mail Passwords].Department,
[SIMS/USER/E-Mail Passwords].[EPIX User ID],
[SIMS/USER/E-Mail Passwords].[EPIX Password],
[SIMS/USER/E-Mail Passwords].[DIP System User ID],
[SIMS/USER/E-Mail Passwords].[DIP System Group],
[SIMS/USER/E-Mail Passwords].[DIP System Password],
[SIMS/USER/E-Mail Passwords].[Mainframe LUN Number],
[SIMS/USER/E-Mail Passwords].[Mainframe Systems Access],
NULL,
NULL
FROM [SIMS/USER/E-Mail Passwords]
UNION
SELECT [External SIMS/USER/E-Mail Passwords].[User ID],
[External SIMS/USER/E-Mail Passwords].Password,
NULL,
[External SIMS/USER/E-Mail Passwords].[SIMS ID],
[External SIMS/USER/E-Mail Passwords].[SIMS Password],
[External SIMS/USER/E-Mail Passwords].[Current User],
NULL,
NULL,
[External SIMS/USER/E-Mail Passwords].Base,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
[External SIMS/USER/E-Mail Passwords].[EMS Online User ID],
[External SIMS/USER/E-Mail Passwords].[EMS Online Password]
FROM [External SIMS/USER/E-Mail Passwords];
Would this Work?
Many Thanks
James
-----Original Message-----
PMJI. Move the second query to first in the set of
UNIONs to get valid
field names or add AS clauses after all your Null
literals in the first
SELECT statement.
--
John Viescas, author
"Microsoft Office Access 2003 Inside Out"
"Running Microsoft Access 2000"
"SQL Queries for Mere Mortals"
http://www.viescas.com/
(Microsoft Access MVP since 1993)
http://www.deanforamerica.com/site/TR?
pg=personal&fr_id=1090&px=1434411
message
Hello Again I have done the following SQL and I get alot
of Exp 1008, 1009 etc fields and things in the wrong
places is there any easy way of correcting this?
Here is the SQL code:
SELECT [External SIMS/USER/E-Mail Passwords].[User ID],
[External SIMS/USER/E-Mail Passwords].Password,
[External
SIMS/USER/E-Mail Passwords].Base, [External SIMS/USER/E-
Mail Passwords].[Current User], [External SIMS/USER/E-
Mail
Passwords].[SIMS ID], [External SIMS/USER/E-Mail
Passwords].[SIMS Password], [External SIMS/USER/E- Mail
Passwords].[EMS Online User ID], [External SIMS/USER/E-
Mail Passwords].[EMS Online
Password],null,null,null,null,null,null,null
FROM [External SIMS/USER/E-Mail Passwords]
UNION
SELECT [SIMS/USER/E-Mail Passwords].[User Name],
[SIMS/USER/E-Mail Passwords].Password, [SIMS/USER/E- Mail
Passwords].[E-Mail Password], [SIMS/USER/E-Mail
Passwords].
[SIMS ID], [SIMS/USER/E-Mail Passwords].[SIMS Password],
[SIMS/USER/E-Mail Passwords].[Current User],
[SIMS/USER/E-
Mail Passwords].[E-Mail Address], [SIMS/USER/E-Mail
Passwords].Department, [SIMS/USER/E-Mail Passwords].
[EPIX
User ID], [SIMS/USER/E-Mail Passwords].[EPIX Password],
[SIMS/USER/E-Mail Passwords].[DIP System User ID],
[SIMS/USER/E-Mail Passwords].[DIP System Group],
[SIMS/USER/E-Mail Passwords].[DIP System Password],
[SIMS/USER/E-Mail Passwords].[Mainframe LUN Number],
[SIMS/USER/E-Mail Passwords].[Mainframe Systems Access]
FROM [SIMS/USER/E-Mail Passwords]
UNION
SELECT
Forname,Surname,Location,Department,Username,Password,
[Type of Dialin], [Support
From],null,null,null,null,null,null,null FROM [SQT Live
CISCO Accounts]
UNION ALL SELECT
IIF(Instr(Trim([Name] & "")," ") >0,
Left([Name], Instr([Name], " ") -1), [Name]) AS Forname,
IIF(Instr(Trim([Name] & "")," ") >0,
Mid([Name], Instr([Name], " ") + 1), [Name]) AS Surname,
NULL,Base,Username,Password,[Type of Dialin],[Support
From],null,null,null,null,null,null,null FROM[live CISCO
Accounts];
Many Thanks
James
-----Original Message-----
Thanks for that but where would I have my other UNION
query?
I have the following code I need to add into this New
UNION Query:
SELECT
Forname,Surname,Location,Department,Username,Password,
[Type of Dialin], [Support From] FROM [SQT Live CISCO
Accounts]
UNION ALL SELECT
IIF(Instr(Trim([Name] & "")," ") >0,
Left([Name], Instr([Name], " ") -1), [Name]) AS
Forname,
IIF(Instr(Trim([Name] & "")," ") >0,
Mid([Name], Instr([Name], " ") + 1), [Name]) AS
Surname,
NULL,Base,Username,Password,[Type of Dialin], [Support
From] FROM[live CISCO Accounts];
So when I have the valid code from the two queries I
will
make where do I put the above code below the two sets I
have copied into my new query?
Many Thanks
James
-----Original Message-----
James
Here's one way to "build" a UNION query...
Create a query against the first table, using the
query
grid. Run it. Does
it return the rows/info you want?
Create a query against the second table, ... (same as
above).
When both are working correctly, and both have the
same
number of and order
of fields, you're ready to build the UNION query.
Open a new query and click the SQL design button to
get
the SQL view window.
Open the first query above, click the SQL view design
button, copy the SQL,
and paste into your new query. Open the second
(above),
copy/paste into
your new query.
Finally, a little cleanup -- remove the ";" after the
first query's SQL, hit
<enter> and add the word "UNION" and <enter>. Make
sure
you have a space
before and after UNION. Now try running it!
Good luck!
Jeff Boyce
<Access MVP>
.
.
.