Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2004
    Posts
    134

    Unanswered: Oposite to cross tab?

    I need to format the table shown :

    Code:
    Estimate | Quantity | Admin_can | Amind_am | Manu_fix | Manu_var
    -------------------------------------------------------------------
    5           | 1000      | .10           | 0.10        | 0.75       | 0.7
    as the following :
    Code:
    Estimate | Variable           | Quantity | Value | Total
    ---------------------------------------------------
    5           | Admin_ca         | 1000      | 0.1    | 100
    5           | Admin_am        | 1000       | 0.1    | 100
    5           | Manu_fix          | 1000      | 0.75   | 750
    5           | Manu_var         | 1000      | 0.7     | 700
    I need to do this so it would be the correct format for a report. Can anyone suggest how to do this? I need to create a view with this format, so speed is
    probably an issue?

    Mike B

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    select Estimate, 'Admin_ca' as Variable, Quantity, Admin_can as Value, Quantity * Admin_can as Total
    UNION
    select Estimate, 'Admin_am' as Variable, Quantity, Amind_am as Value, Quantity * Amind_am as Total
    UNION
    select Estimate, 'Manu_fix' as Variable, Quantity, Manu_fix as Value, Quantity * Manu_fix as Total
    UNION
    select Estimate, 'Manu_var' as Variable, Quantity, Manu_var as Value, Quantity * Manu_var as Total
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •