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 8451107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T11:08:54+00:00 2026-06-10T11:08:54+00:00

i want to rotate my table horizontally – The tables are as follows: Master_Choicecode

  • 0

i want to rotate my table horizontally –

The tables are as follows:

Master_Choicecode

ChoiceCode      MainCourseId    CourseLevelId    InstituteId

Master_MainCourse

MainCourseId     MainCourseName   CourseLevelId   CourseProgram
   11                x                1             abc
   12                y                2             xyz

Master_CourseLevel

CourseLevelId    CourseLevelName     
   1                deg
   2                Dip

Master_Institute

Instituteid     InstituteName    Statusid
    1001           Insti1          100
    1002           Insti2          200

Master_InstituteStatus

StatusId   StatusName
  100            Status1
  200            Status2

Now using all these tables i want to show this:

CourseProgram   CourseLevelName  Status1(from Master_InstituteStatus)     Status2(from Master_InstituteStatus)    
    abc             Deg          Count of institutes belonging to status1  Count of institutes belonging to status2

Now this is what i have tried:

SELECT B.CourseProgram,C.CourseLevelName,
case when E.InstituteStatusName =' Status1' then COUNT(*) else null end as     Status1,
case when E.InstituteStatusName =' Status2' then COUNT(*) else null  end as  Status2,
FROM Master_ChoiceCode A 
inner join Master_MainCourse B on A.MainCourseID=B.MainCourseID
inner join Master_CourseLevel C on A.CourseLevelID=C.CourseLevelID  
inner join  Master_Institute D on A.InstituteID=D.InstituteID
inner join Master_InstituteStatus1 E on D.InstituteStatusID1=E.InstituteStatusID
where B.CourseLevelID IN(1,2)
GROUP BY B.CourseProgram,A.CourseLevelID,C.CourseLevelName,E.InstituteStatusName
order by B.CourseProgram,C.CourseLevelName;

But with this i get the output like this:

CourseProgram   CourseLevelName  Status1(from Master_InstituteStatus)     Status2(from Master_InstituteStatus)    
    abc             Deg          Count of institutes belonging to status1  
    abc             Deg                      Null                              Count of institutes belonging to status1

i got the solution to this is to use pivot…but i dont knw how shal i use Pivot with my current query.Please help me..

  • 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-10T11:08:55+00:00Added an answer on June 10, 2026 at 11:08 am

    You’re close, but grouping on E.InstituteStatusName means you will not be able to combine the data onto one row. Rather than use the case statement with a count, you could use a conditional sum.

    SELECT B.CourseProgram,C.CourseLevelName,
    sum(case when E.InstituteStatusName =' Status1' then 1 else 0 end) as     Status1,
    sum(case when E.InstituteStatusName =' Status2' then 1 else 0 end) as  Status2,
    FROM Master_ChoiceCode A 
    inner join Master_MainCourse B on A.MainCourseID=B.MainCourseID
    inner join Master_CourseLevel C on A.CourseLevelID=C.CourseLevelID  
    inner join  Master_Institute D on A.InstituteID=D.InstituteID
    inner join Master_InstituteStatus1 E on D.InstituteStatusID1=E.InstituteStatusID
    where B.CourseLevelID IN(1,2)
    GROUP BY B.CourseProgram,A.CourseLevelID,C.CourseLevelName
    order by B.CourseProgram,C.CourseLevelName;
    

    This will effectively count the rows matching that status without the need for grouping on that field.

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

Sidebar

Related Questions

for example I have the table below and want to rotate it like the
I want to rotate the log like in mySQL, but now for an H2
I want to rotate imageview with continuously looping on android.my code rotate is working
I want to rotate a single word of text by 90 degrees, with cross-browser
I want to rotate the location where temporary files are written however it is
Hi I want to rotate a control on its right bottom point(like a clock
My problem is that I want to rotate the UIImageView of a UIButton .
I have a cube which I want to rotate. I also have a light
I have an object which I first want to rotate (about its own center)
I have a great problem about the rotation in three.js I want to rotate

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.