Note that there are some explanatory texts on larger screens.

plurals
  1. PORetrieve column names from a different table?
    primarykey
    data
    text
    <p>I have a "datadump" table that has a bunch of mixed performance-related data. Something like: </p> <pre><code>MachID TestDate MachType Value1 Value2 ... 00001 01/01/09 Server 15 48 00001 01/02/09 Server 16 99 19999 01/01/09 Switch 32 4.9880 19999 01/02/09 Switch 32 5.8109 </code></pre> <p>The trick is that the "values" columns <em>MEAN</em> different things for different types of machines. So we have a "xRef" table that looks like:</p> <pre><code>MachType Column Description Server Value1 Users Connected Server Value2 % CPU _total Switch Value1 Number of Ports Switch Value2 packets/ms ... </code></pre> <p>I know, weird structure, but I didn't make it, and can't change it.</p> <p>I'd like to somehow "inner join" these so I can query the appropriate column headers based on the type of data. Something like this for the servers:</p> <pre><code>MachID TestDate MachType Users Connected % CPU _total Total RAM 00001 01/01/09 Server 15 48 4096 00001 01/02/09 Server 16 99 4096 </code></pre> <p>and this for the switches:</p> <pre><code>MachID TestDate MachType Number of Ports packets/ms Total Cumulative kb 19999 01/01/09 Switch 32 4.9880 1024547 19999 01/02/09 Switch 32 5.8109 1029450 </code></pre> <p>Is there a way to do this without doing individual hard-coded queries for each type?</p> <p><strong>Note</strong>: I will only need to query one <em>type</em> of object at a time. Most likely, I'll only be looking at all results between particular dates for a single MachID, if that helps. This is MS SQL 2000.</p> <p>Thanks!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload