Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Union Query - Need another pair of eyes

Posted on 2014-03-12
2
Medium Priority
?
190 Views
Last Modified: 2014-03-12
Getting  error after From?  What am I missing

INSERT INTO tblQuarterly_AchievedPct ( ContractNumber, Quarter, Tier1, Tier2, Tier3, Tier4, Tier5, Tier6 )
SELECT  tblContracts.ContractNumber, 1 AS Qtr, tblContracts.Q1T1, tblContracts.Q1T2, tblContracts.Q1T3, tblContracts.Q1T4, tblContracts.Q1T5, tblContracts.Q1T6
FROM tblContracts
Union All
SELECT  tblContracts.ContractNumber, 2 AS Qtr, tblContracts.Q2T1, tblContracts.Q2T2, tblContracts.Q2T3, tblContracts.Q2T4, tblContracts.Q2T5, tblContracts.Q2T6
FROM tblContracts
Union All
SELECT  tblContracts.ContractNumber, 3 AS Qtr, tblContracts.Q3T1, tblContracts.Q3T2, tblContracts.Q3T3, tblContracts.Q3T4, tblContracts.Q3T5, tblContracts.Q3T6
FROM tblContracts
Union All
SELECT  tblContracts.ContractNumber, 4 AS Qtr, tblContracts.Q4T1, tblContracts.Q4T2, tblContracts.Q4T3, tblContracts.Q4T4, tblContracts.Q4T5, tblContracts.Q4T6
FROM tblContracts

Open in new window

0
Comment
Question by:Karen Schaefer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 total points
ID: 39924119
try this

INSERT INTO tblQuarterly_AchievedPct ( ContractNumber, Quarter, Tier1, Tier2, Tier3, Tier4, Tier5, Tier6 )
SELECT A.ContractNumber, A.Qtr, A.Q1T1, A.Q1T2, A.Q1T3, A.Q1T4, A.Q1T5, A.Q1T6
From
(
SELECT  tblContracts.ContractNumber, 1 AS Qtr, tblContracts.Q1T1, tblContracts.Q1T2, tblContracts.Q1T3, tblContracts.Q1T4, tblContracts.Q1T5, tblContracts.Q1T6
FROM tblContracts
Union All
SELECT  tblContracts.ContractNumber, 2 AS Qtr, tblContracts.Q2T1, tblContracts.Q2T2, tblContracts.Q2T3, tblContracts.Q2T4, tblContracts.Q2T5, tblContracts.Q2T6
FROM tblContracts
Union All
SELECT  tblContracts.ContractNumber, 3 AS Qtr, tblContracts.Q3T1, tblContracts.Q3T2, tblContracts.Q3T3, tblContracts.Q3T4, tblContracts.Q3T5, tblContracts.Q3T6
FROM tblContracts
Union All
SELECT  tblContracts.ContractNumber, 4 AS Qtr, tblContracts.Q4T1, tblContracts.Q4T2, tblContracts.Q4T3, tblContracts.Q4T4, tblContracts.Q4T5, tblContracts.Q4T6
FROM tblContracts
) As A
0
 

Author Closing Comment

by:Karen Schaefer
ID: 39924228
thanks that did it.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

636 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