I am trying to turn a list of data that looks like this:
ID A B C
---- ---- ---- ----
1 0 1 3
2 1 2 1
Into a result set that looks like this on a report:
ID Product Qty
---- ----------- -----
1 B 1
1 B 3
2 A 1
2 A 2
2 A 1
Is this possible? If so, how would I do it? I would prefer not having
to use VB, I would rather solve this in SQL/Queries alone.
Using Access 2000 or SQL Server 2000
Marco 3 1796
Try this ...
SELECT tblData.ID, 'A' AS Type, [A] As Value
UNION
SELECT tblData.ID, 'B' AS Type, [b] As Value
UNION
SELECT tblData.ID, 'C' AS Type, [C] As Value
ORDER BY ID, Type, Value
--
Danny J. Lesandrini dl*********@hotmail.com http://amazecreations.com/datafast
"Flash" <ma***********@merial.com> wrote ... I am trying to turn a list of data that looks like this:
ID A B C ---- ---- ---- ---- 1 0 1 3 2 1 2 1
Into a result set that looks like this on a report:
ID Product Qty ---- ----------- ----- 1 B 1 1 B 3 2 A 1 2 A 2 2 A 1
Is this possible? If so, how would I do it? I would prefer not having to use VB, I would rather solve this in SQL/Queries alone.
Using Access 2000 or SQL Server 2000
Marco
Actually, this is more like it ...
SELECT tblData.ID, 'A' AS Product, tblData.[A] As Qty
UNION
SELECT tblData.ID, 'B' AS Product, tblData.[b] As Qty
UNION
SELECT tblData.ID, 'C' AS Product, tblData.[C] As Qty
ORDER BY ID, Product, Qty
--
Thank you
That's what I was looking for.
Danny J. Lesandrini wrote: Actually, this is more like it ...
SELECT tblData.ID, 'A' AS Product, tblData.[A] As Qty UNION SELECT tblData.ID, 'B' AS Product, tblData.[b] As Qty UNION SELECT tblData.ID, 'C' AS Product, tblData.[C] As Qty ORDER BY ID, Product, Qty
-- This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Ed_No_Spam_Please_Weber |
last post by:
Hello All & Thanks in advance for your help!
Background:
1) tblT_Documents is the primary parent transaction table that has 10
fields and about 250,000 rows
2) There are 9 child tables with...
|
by: MX1 |
last post by:
Here's a simple query question. I have tables. One is an order table and
one is an order detail table.
tOrder
tOrderDetail
The tOrder table contains basic info like customer name, date, a...
|
by: Bob |
last post by:
Hi Everybody
Difficult question
Has anyone else used the "Using the Tab control as a container"
database example that comes with the above book chapter 7 on the
accompanying disc. It is a...
|
by: C White |
last post by:
Hi
I am having problems with running a query that does the following
there are 5 fields in a table that the query is based on, the first four
are simple enough and all that happens is that the...
|
by: Rolan |
last post by:
There must be a way to enhance the performance of a query, or find a
plausible workaround, but I seem to be hitting a wall. I have tried a
few tweaks, however, there has been no improvement.
...
|
by: Jack |
last post by:
TblProduct
ProductID
ProductName
Selected (Y/N)
TblOrder
OrderID
CustomerID
TblOrderDetail
|
by: serge |
last post by:
How can I run a single SP by asking multiple sales question either
by using the logical operator AND for all the questions; or using
the logical operator OR for all the questions. So it's always...
|
by: jmarr02s |
last post by:
I don't know what I am doing wrong I get duplicate records when I query
Here is my SQL query code:
SELECT Utilization_T.Facid, Utilization_T.Year, Utilization_T.Beds,
Utilization_T.LicBeds,...
|
by: Bob Bridges |
last post by:
Start with two tables, parent records in one and child records in the other,
a one-to-many relationship. Create a select statement joining the two.
Display the query in datasheet mode. When I...
|
by: randyse |
last post by:
Hello all,
This is my first post, please let me know if I've missed any relevant data or guidelines.
I'm using Access 2003 for the database and Excel 2003 for the reporting to avoid having...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |