Query Assistance

rel9703

New Member
Joined
Sep 13, 2017
Messages
1
Working with databases is new to me so thank you for any assistance you can provide. I have a database where data is stored as follows:

Table: Rates
[TABLE="class: MsoTableGrid"]
<tbody>[TR]
[TD="width: 61, bgcolor: transparent"] Company<o:p></o:p>
[/TD]
[TD="width: 48, bgcolor: transparent"] Item<o:p></o:p>
[/TD]
[TD="width: 78, bgcolor: transparent"] Labor Rate<o:p></o:p>
[/TD]
[TD="width: 72, bgcolor: transparent"] Matl Rate<o:p></o:p>
[/TD]
[/TR]
[TR]
[TD="width: 61, bgcolor: transparent"] AAA<o:p></o:p>
[/TD]
[TD="width: 48, bgcolor: transparent"] Pipe<o:p></o:p>
[/TD]
[TD="width: 78, bgcolor: transparent"] 45<o:p></o:p>
[/TD]
[TD="width: 72, bgcolor: transparent"] 87<o:p></o:p>
[/TD]
[/TR]
[TR]
[TD="width: 61, bgcolor: transparent"] AAA<o:p></o:p>
[/TD]
[TD="width: 48, bgcolor: transparent"] Beam<o:p></o:p>
[/TD]
[TD="width: 78, bgcolor: transparent"] 56<o:p></o:p>
[/TD]
[TD="width: 72, bgcolor: transparent"] 75<o:p></o:p>
[/TD]
[/TR]
[TR]
[TD="width: 61, bgcolor: transparent"] AAA<o:p></o:p>
[/TD]
[TD="width: 48, bgcolor: transparent"] Cable<o:p></o:p>
[/TD]
[TD="width: 78, bgcolor: transparent"] 34<o:p></o:p>
[/TD]
[TD="width: 72, bgcolor: transparent"] 42<o:p></o:p>
[/TD]
[/TR]
[TR]
[TD="width: 61, bgcolor: transparent"] BBB<o:p></o:p>
[/TD]
[TD="width: 48, bgcolor: transparent"] Pipe<o:p></o:p>
[/TD]
[TD="width: 78, bgcolor: transparent"] 48<o:p></o:p>
[/TD]
[TD="width: 72, bgcolor: transparent"] 92<o:p></o:p>
[/TD]
[/TR]
[TR]
[TD="width: 61, bgcolor: transparent"] BBB<o:p></o:p>
[/TD]
[TD="width: 48, bgcolor: transparent"] Beam<o:p></o:p>
[/TD]
[TD="width: 78, bgcolor: transparent"] 51<o:p></o:p>
[/TD]
[TD="width: 72, bgcolor: transparent"] 63<o:p></o:p>
[/TD]
[/TR]
[TR]
[TD="width: 61, bgcolor: transparent"] BBB<o:p></o:p>
[/TD]
[TD="width: 48, bgcolor: transparent"] Cable<o:p></o:p>
[/TD]
[TD="width: 78, bgcolor: transparent"] 34<o:p></o:p>
[/TD]
[TD="width: 72, bgcolor: transparent"] 43<o:p></o:p>
[/TD]
[/TR]
</tbody>[/TABLE]


I want to write query to return the following:

[TABLE="class: MsoTableGrid"]
<tbody>[TR]
[TD="width: 43, bgcolor: transparent"] Item<o:p></o:p>
[/TD]
[TD="width: 66, bgcolor: transparent"] AAA Labor Rate<o:p></o:p>
[/TD]
[TD="width: 66, bgcolor: transparent"] AAA Matl Rate<o:p></o:p>
[/TD]
[TD="width: 66, bgcolor: transparent"] BBB Labor Rate<o:p></o:p>
[/TD]
[TD="width: 61, bgcolor: transparent"] BBB Matl Rate<o:p></o:p>
[/TD]
[/TR]
[TR]
[TD="width: 43, bgcolor: transparent"] Pipe<o:p></o:p>
[/TD]
[TD="width: 66, bgcolor: transparent"] 45<o:p></o:p>
[/TD]
[TD="width: 66, bgcolor: transparent"] 87<o:p></o:p>
[/TD]
[TD="width: 66, bgcolor: transparent"] 48<o:p></o:p>
[/TD]
[TD="width: 61, bgcolor: transparent"] 92<o:p></o:p>
[/TD]
[/TR]
[TR]
[TD="width: 43, bgcolor: transparent"] Beam<o:p></o:p>
[/TD]
[TD="width: 66, bgcolor: transparent"] 56<o:p></o:p>
[/TD]
[TD="width: 66, bgcolor: transparent"] 75<o:p></o:p>
[/TD]
[TD="width: 66, bgcolor: transparent"] 51<o:p></o:p>
[/TD]
[TD="width: 61, bgcolor: transparent"] 63<o:p></o:p>
[/TD]
[/TR]
[TR]
[TD="width: 43, bgcolor: transparent"] Cable<o:p></o:p>
[/TD]
[TD="width: 66, bgcolor: transparent"] 34<o:p></o:p>
[/TD]
[TD="width: 66, bgcolor: transparent"] 42<o:p></o:p>
[/TD]
[TD="width: 66, bgcolor: transparent"] 34<o:p></o:p>
[/TD]
[TD="width: 61, bgcolor: transparent"] 43<o:p></o:p>
[/TD]
[/TR]
</tbody>[/TABLE]

I have been trying for several days without success. Can anyone please offer some suggestions?

Thanks!
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Hi,

that is not the standard output for queries. Also if you have enough companies (say more than 10-20) you will have an excessively long report in terms of its sideways length.

In short, the data in the table looks great already as a good way to view the data. Why would you want to see it the other way? If you insist, however, you can probably do this using a crosstab query (maybe), by summing the data values. But there can only be one value in the table for each combination of company and material, or the summing will create bad results.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top