Modify A Query Again

C

carl

I am trying to work around an issue I have.

Currently I use these 2 queries:

Q1
SELECT Query3.OCC_Vol, AS BOX_Vol, (/OCC_Vol) AS BOX, [A]/
OCC_Vol AS AMEX, [P]/OCC_Vol AS ARCA, [Z]/OCC_Vol AS BATS, [C]/OCC_Vol
AS CBOE, [W]/OCC_Vol AS C2, /OCC_Vol AS ISE, [Q]/OCC_Vol AS NOM,
[X]/OCC_Vol AS PHLX
FROM Query3
ORDER BY OCC_Vol DESC;


Which generates this output...

OCC_Vol BOX_Vol BOX AMEX
17,439,351 513,649 2.95% 13.47%


Q2
SELECT Query1.underlying, Query1.OCC_Vol, Query1.B AS BOX_Vol, (/
OCC_Vol) AS BOX, [A]/OCC_Vol AS AMEX, [P]/OCC_Vol AS ARCA, [Z]/OCC_Vol
AS BATS, [C]/OCC_Vol AS CBOE, [W]/OCC_Vol AS C2, /OCC_Vol AS ISE,
[Q]/OCC_Vol AS NOM, [X]/OCC_Vol AS PHLX
FROM Query1
ORDER BY OCC_Vol DESC;

Which generates this output...

underlying OCC_Vol BOX_Vol BOX AMEX
SPY 2,212,187 46,832 2.12% 12.01%
SLV 1,285,651 46,377 3.61% 17.26%
STX 983,631 809 0.08% 0.09%

Is there a way of changing either query (or creating a new one) that
can generate this output - taking the result of Q1 and creating the
new row named "Overall"...

underlying OCC_Vol BOX_Vol BOX AMEX
Overall 17,439,351 513,649 2.95% 13.47%
SPY 2,212,187 46,832 2.12% 12.01%
SLV 1,285,651 46,377 3.61% 17.26%
STX 983,631 809 0.08% 0.09%


Thanks in advance
 
B

Bob Barrows

carl said:
I am trying to work around an issue I have.

Currently I use these 2 queries:

Q1
Which generates this output...

OCC_Vol BOX_Vol BOX AMEX
17,439,351 513,649 2.95% 13.47%
It generates a single row? Why bother with the ORDER BY clause?
Is there a way of changing either query (or creating a new one) that
can generate this output - taking the result of Q1 and creating the
new row named "Overall"...

underlying OCC_Vol BOX_Vol BOX AMEX
Overall 17,439,351 513,649 2.95% 13.47%
SPY 2,212,187 46,832 2.12% 12.01%
SLV 1,285,651 46,377 3.61% 17.26%
STX 983,631 809 0.08% 0.09%
It would be a union query similar to those we've shown you before:

select 'Overall' As underlying, * FROM Q1
UNION ALL
select * FROM Q2
 

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

Similar Threads

Sorting 1
Union Query 1
Query Question 1
Can A Form Be Used Instead Of Cut/Paste To Excel ? 4

Top