Hello,
I have a database that several tables (tbl113 , tbl114 , tbl115), each has
identical columns (DPGId , Description , serialnumber , columnlocation)
How can I do a query that will produce all the DPGId's in the same columns
as well as Description's , serialnumbers and columnlocations in their
respective columns ?
SELECT DPGid , Description , PostLocation , SerialNumber FROM tbl113 ,
tbl114 , tbl115 ; gives error
Thanks in advance
Dan S
--
Danny C. Sperry
Message posted via http://www.accessmonster.com
|
|
0
|
|
|
|
Reply
|
Dsperry101
|
10/2/2007 11:18:45 AM |
|
It sounds as though you want to view the records from each table as if it
were one table. Use a union query to do that...
SELECT DPGid , Description , PostLocation , SerialNumber FROM tbl113
UNION
SELECT DPGid , Description , PostLocation , SerialNumber FROM tbl114
UNION
SELECT DPGid , Description , PostLocation , SerialNumber FROM tbl115
"UNION" will not list duplicate rows, whereas "UNION ALL" will return the
duplicates, I think.
If you want to rename the column headings, do so in the first SELECT
statement.
Hope this helps,
David
"Dsperry101 via AccessMonster.com" wrote:
> Hello,
>
> I have a database that several tables (tbl113 , tbl114 , tbl115), each has
> identical columns (DPGId , Description , serialnumber , columnlocation)
> How can I do a query that will produce all the DPGId's in the same columns
> as well as Description's , serialnumbers and columnlocations in their
> respective columns ?
> SELECT DPGid , Description , PostLocation , SerialNumber FROM tbl113 ,
> tbl114 , tbl115 ; gives error
>
> Thanks in advance
> Dan S
>
> --
> Danny C. Sperry
>
> Message posted via http://www.accessmonster.com
>
>
|
|
0
|
|
|
|
Reply
|
Utf
|
10/2/2007 12:05:01 PM
|
|
Use a UNION ALL query (or a UNION query).
SELECT DPGid , Description , PostLocation , SerialNumber
FROM tbl113
UNION ALL
SELECT DPGid , Description , PostLocation , SerialNumber
FROM tbl114
UNION ALL
SELECT DPGid , Description , PostLocation , SerialNumber
FROM tbl115
This query can only be built in SQL view. The query design view (the grid)
cannot build a union query.
--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
"Dsperry101 via AccessMonster.com" <u24149@uwe> wrote in message
news:791603421abce@uwe...
> Hello,
>
> I have a database that several tables (tbl113 , tbl114 , tbl115), each
> has
> identical columns (DPGId , Description , serialnumber , columnlocation)
> How can I do a query that will produce all the DPGId's in the same
> columns
> as well as Description's , serialnumbers and columnlocations in their
> respective columns ?
> SELECT DPGid , Description , PostLocation , SerialNumber FROM tbl113 ,
> tbl114 , tbl115 ; gives error
>
> Thanks in advance
> Dan S
>
> --
> Danny C. Sperry
>
> Message posted via http://www.accessmonster.com
>
|
|
0
|
|
|
|
Reply
|
John
|
10/2/2007 12:16:55 PM
|
|
David,
Is the query a single query ? I tried this :
SELECT DPGid , Description , PostLocation , SerialNumber FROM tbl113 ,
tbl114 , tbl115 UNION ALL;
got an error
John Spencer wrote:
>Use a UNION ALL query (or a UNION query).
>
>SELECT DPGid , Description , PostLocation , SerialNumber
>FROM tbl113
>UNION ALL
>SELECT DPGid , Description , PostLocation , SerialNumber
>FROM tbl114
>UNION ALL
>SELECT DPGid , Description , PostLocation , SerialNumber
>FROM tbl115
>
>This query can only be built in SQL view. The query design view (the grid)
>cannot build a union query.
>> Hello,
>>
>[quoted text clipped - 10 lines]
>> Thanks in advance
>> Dan S
--
Danny C. Sperry
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-queries/200710/1
|
|
0
|
|
|
|
Reply
|
Dsperry101
|
10/2/2007 12:47:00 PM
|
|
David ,
I did a little experimenting and got it working, thanks for your time and
knowledge.
Dan S
Dsperry101 wrote:
>David,
>
> Is the query a single query ? I tried this :
>
> SELECT DPGid , Description , PostLocation , SerialNumber FROM tbl113 ,
>tbl114 , tbl115 UNION ALL;
>got an error
>>Use a UNION ALL query (or a UNION query).
>>
>[quoted text clipped - 14 lines]
>>> Thanks in advance
>>> Dan S
>
--
Danny C. Sperry
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-queries/200710/1
|
|
0
|
|
|
|
Reply
|
Dsperry101
|
10/2/2007 1:08:01 PM
|
|
|
4 Replies
718 Views
(page loaded in 0.096 seconds)
Similiar Articles: query multiple tables with identical column names - microsoft ...query multiple tables with identical column names - microsoft ... HELP: Compare Column values with column names in different tables ... query multiple tables with ... Compare Multiple Fields in Two Tables and Show Whats Different ...These tables are supposed to be identical ... the same column headings (for the sake of this query, I ... values with column names in different tables ... Compare Multiple ... HELP: Compare Column values with column names in different tables ...query multiple tables with identical column names - microsoft ... HELP: Compare Column values with column names in different tables ... query multiple tables with ... Data Verification: Comparing Two Identical Tables in MS ACCESS ...query multiple tables with identical column names - microsoft ... Data Verification: Comparing Two Identical Tables in MS ACCESS ... query multiple tables with identical ... Crosstab with multiple columns? - microsoft.public.access.queries ...query multiple tables with identical column names - microsoft ..... microsoft.public.windowsmedia ... query multiple tables with identical column names - microsoft ... SELECT DISTINCT (multiple columns/tables) - microsoft.public ...query multiple tables with identical column names - microsoft ... SELECT DISTINCT (multiple columns/tables) - microsoft.public ... query multiple tables with identical ... inserting multiple columns from combo list - microsoft.public ...query multiple tables with identical column names - microsoft ... inserting multiple columns from combo list - microsoft.public ..... timecard table. Query with multiple fields - microsoft.public.accessquery multiple tables with identical column names - microsoft ... Hello, I have a database that several tables (tbl113 , tbl114 , tbl115), each has identical columns ... How to print a simple list of tables, queries & forms ...SELECT IIf([MSysObjects].[Type]=1,'TABLE',IIf([MSysObjects].[Type]=5,'QUERY',IIf ... BY MSysObjects.Type, MSysObjects.Name; In Query Design View, make sure the Name ... Multiple ADD COLUMN in one shot? - microsoft.public.access.queries ...I have a statement in a query like: ALTER TABLE EXP ADD COLUMN first_name TEXT(75 ... Microsoft ASP.NET Forums-- --Add multiple columns. ALTER TABLE testTable Add column ... query multiple tables with identical column names - microsoft ...query multiple tables with identical column names - microsoft ... HELP: Compare Column values with column names in different tables ... query multiple tables with ... Two Different Tables, Each With Identical Column Names... Query HelpTwo Different Tables, Each With Identical Column Names... Query Help I have two different tables ... Looping Through Importing Identical Tables From Multiple Databases I ... Manual :: Gets info about columns in a table or a query result... element provides an array with the column names as ... If a result set has identical field names, the last one is ... DBMS's are unable to determine table names from query ... SQL basics: Query multiple tables | TechRepublicA simple SELECT statement is the most basic way to query multiple tables. ... If your column names don’t match when you use the UNION statement, use aliases ... Working with Multiple Tables in a Query | Working with Multiple ...... calculated column. Figure 3.7 shows the resulting dynaset. Figure 3.6 A query with three related tables that ... tables in a multiple-table query share a common field name ... 7/25/2012 1:00:09 PM
|