Union Query Not writing to table

B

Brian

I have a union query that is quite simple:

SELECT DetailCust.OrderNumber,
Mid(DetailCust.ProductCode,3,2)+MID(DetailCust.ProductCode,7,2) AS Expr1,
DetailCust.Quantity, DetailCust.UnitPrice, DetailCust.ExtendedPrice
FROM DetailCust
WHERE (((DetailCust.ProductCode) Like "tbjm*"));
UNION
SELECT DetailCust.OrderNumber,
Left(DetailCust.ProductCode,2)+MID(DetailCust.ProductCode,5,2) AS Expr1,
DetailCust.Quantity, DetailCust.UnitPrice, DetailCust.ExtendedPrice
FROM DetailCust
WHERE (((DetailCust.ProductCode) Like "tbjm*"));

The query runs great an I get the data I am expecting. How do I save it in
the table, or do I have to add it to another table?

Brian
 
A

Amy Blankenship

Why do you need to store the information again, since you already have it
and have no trouble querying it?
 
6

'69 Camaro

Hi, Brian.
How do I save it in
the table

Save the UNION query, then create a new make table query with the UNION query as
the data source. For example:

SELECT * INTO NewTable
FROM qryUnion;

.. . . where NewTable is the name of the new table you want to create and
qryUnion is the name of your UNION query.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact info.


I have a union query that is quite simple:

SELECT DetailCust.OrderNumber,
Mid(DetailCust.ProductCode,3,2)+MID(DetailCust.ProductCode,7,2) AS Expr1,
DetailCust.Quantity, DetailCust.UnitPrice, DetailCust.ExtendedPrice
FROM DetailCust
WHERE (((DetailCust.ProductCode) Like "tbjm*"));
UNION
SELECT DetailCust.OrderNumber,> The query runs great an I get the data I am
expecting. How do I save it in
the table
Left(DetailCust.ProductCode,2)+MID(DetailCust.ProductCode,5,2) AS Expr1,
DetailCust.Quantity, DetailCust.UnitPrice, DetailCust.ExtendedPrice
FROM DetailCust
WHERE (((DetailCust.ProductCode) Like "tbjm*"));
, or do I have to add it to another table?
 
B

Bscs63

The reason dor the save is that the customer Ireceive the data from uses
codes for the products. In this case the code in this example is for two
products which I split so the inventory can read the products. The TBJM* is
actually TBJM4001 which needs to split to TB40 and JM01. These are the
actual products I would ship.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top