0

I have the following table with column school, state, subject and timedate. enter image description here

I would like to have output with column school, state, act and english

  • filter subjects to only Act and English
  • pivot table to match school and state

enter image description here

I did tried but all queries are not work. Hopefully someone may help. Thanks.

1
  • Please consider reading this advice Commented May 24, 2020 at 14:40

1 Answer 1

0

Quickly:

select school, state, Act, English, History
from (select school, state, subject, timedate
      from data) as pivotdata
         pivot (max(timedate) for subject in (Act, English, History)) as P

Should work

enter image description here

1
  • can you show a picture of the result of this query? just to see if it matches the expected result Commented May 25, 2020 at 0:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.