Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8387691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:16:59+00:00 2026-06-09T18:16:59+00:00

Given data looks like PLI_ID OWN_ID DCSF_ID SCH_NAME PREMIUM1 PREMIUM2 DESCRIPTION 901 2 1000

  • 0

Given data looks like

PLI_ID   OWN_ID   DCSF_ID   SCH_NAME          PREMIUM1 PREMIUM2  DESCRIPTION  
901      2        1000     Dfe-School 1        86.40     7.20    Heads, Deps
902      2        1000     Dfe-School 2        403.30    8.40    Relief Bursar
903      2        1000     Dfe-School 3        327.00    8.40    £10.00 
904      2        1000     Dfe-School 4        381.50    8.40    £11.00 
905      2        1000     Dfe-School 5        152.60    8.40    Teaching staff

Expected data to look like

School          £10.00  £11.00  Heads, Deps  Relief Bursar  Teaching staff  Total
Dfe-School 1                            
Dfe-School 2                            
Dfe-School 3                            
Dfe-School 4                            

Total                                                                  [Pre-Total]

I am not sure whether to write a Cross Tab or Cross Over query, as suggested. Let me know, if need more explanation.

My query uses around 6 tables and it looks like this:

SELECT PolicyLine.PLI_POS_Id, Policy.POL_OWN_Id, Policy.POL_DCSF, School.SCH_Name, PolicyLine.PLI_Premium, CoverPremium.CPR_Premium, StaffCategory.SCA_Description FROM
School 
INNER JOIN Policy ON School.SCH_OWN_Id = Policy.POL_OWN_Id AND School.SCH_DCSF = Policy.POL_DCSF 
INNER JOIN PolicyLine ON Policy.POL_Id = PolicyLine.PLI_POL_Id 
INNER JOIN CoverOption ON PolicyLine.PLI_COP_Id = CoverOption.COP_Id 
INNER JOIN  CoverPremium ON CoverOption.COP_Id = CoverPremium.CPR_COP_Id AND Policy.POL_OWN_Id = CoverPremium.CPR_OWN_Id 
RIGHT OUTER JOIN StaffCategory ON CoverOption.COP_SCA_Id = StaffCategory.SCA_
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T18:17:01+00:00Added an answer on June 9, 2026 at 6:17 pm

    Based on your existing query you would use something like this:

    SELECT School.SCH_Name school,
      [£10.00], [£11.00], 
      [Heads, Deps], [Relief Bursar], [Teaching staff]
    FROM
    (
      SELECT PolicyLine.PLI_POS_Id, 
        Policy.POL_OWN_Id, 
        Policy.POL_DCSF, 
        School.SCH_Name, 
        PolicyLine.PLI_Premium, 
        CoverPremium.CPR_Premium, 
        StaffCategory.SCA_Description 
      FROM School 
      INNER JOIN Policy 
        ON School.SCH_OWN_Id = Policy.POL_OWN_Id 
        AND School.SCH_DCSF = Policy.POL_DCSF 
      INNER JOIN PolicyLine 
        ON Policy.POL_Id = PolicyLine.PLI_POL_Id 
      INNER JOIN CoverOption 
        ON PolicyLine.PLI_COP_Id = CoverOption.COP_Id 
      INNER JOIN  CoverPremium 
        ON CoverOption.COP_Id = CoverPremium.CPR_COP_Id 
        AND Policy.POL_OWN_Id = CoverPremium.CPR_OWN_Id 
      RIGHT OUTER JOIN StaffCategory 
        ON CoverOption.COP_SCA_Id = StaffCategory.SCA_
    ) x
    PIVOT
    (
      sum(PLI_Premium)
      for SCA_Description in([£10.00], [£11.00], 
                         [Heads, Deps], [Relief Bursar], [Teaching staff])
    ) p
    

    See SQL Fiddle with Demo

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given an IList<Foo> with a data set that looks like this: ID CHILD PARENT
Given data that looks like: library(data.table) DT <- data.table(x=rep(1:5, 2)) I would like to
Given data like this C1<-c(3,-999.000,4,4,5) C2<-c(3,7,3,4,5) C3<-c(5,4,3,6,-999.000) DF<-data.frame(ID=c(A,B,C,D,E),C1=C1,C2=C2,C3=C3) How do I go about removing
Given a data set like this; +-----+---------------------+--------+ | id | date | result |
Given data that looks similar to this: +---------+-----------+----------+ | country | city | district
I have data that looks like the following: ID | Location | Attendees |
Basically I have an XML file that looks like this: <?xml version=1.0 encoding=UTF-8?> <data>
My data looks like this: 00000000001 : `12341234...12341234' Basically a unique id value associated
Given the code (which looks like it should be valid): <!--[if lt IE 7]>
I have a Table that looks like this MAC-ADDRESS | ACCESSPOINT | TIMESTAMP Data

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.