Displaying Data from a table

  • Table structure:

    G_Code            Num_Avail         type


    1                             5             Blue

    2                             2             White

    3                             2             White

     

          How can I  create the following resultset:

     

     [Available White]   [Available Blue]  [Total Available]

             4                      5                     9

     

     

     

     

     

     

  • Select SUM(case when type = 'White' then Num_Avail else NULL end) as Available_White, SUM(case when type = 'Blue' then Num_Avail else NULL end) as Available_Blue, SUM(Num_Avail) as Total Available

    FROM <table_Name>

    _____________
    Code for TallyGenerator

  • Thanks Sergiy. I really do appreciate your time and help.

  • Thanks a million.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply