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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:41:22+00:00 2026-06-12T22:41:22+00:00

List item I am new to php and I am trying to do the

  • 0

List item

I am new to php and I am trying to do the following:

empid  Salary   Month
1      2342     Jan 
1      3234     Feb
1      3445     Mar
2      3222     Jan
2      3342     Feb
3      3352     Mar

How do I display it as:

empid  jan   feb    mar
1      2342  3234  3445
2      3222  3342  3352
  • 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-12T22:41:23+00:00Added an answer on June 12, 2026 at 10:41 pm

    You need to pivot rows into columns like so:

    SELECT
      emp_id,
      MAX(CASE WHEN month_end = 'jan' THEN salary END) 'jan',
      MAX(CASE WHEN month_end = 'feb' THEN salary END) 'feb',
      MAX(CASE WHEN month_end = 'mar' THEN salary END) 'mar'
    FROM Emps
    GROUP BY emp_id
    

    And this is the standard way to do this. It should work for all RDBMS.

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

Sidebar

Related Questions

I am trying to get each new line of textarea as a list item
I have a List item List<string> xmlValue = new List<string>(); In this I have
When I add a new item in a default Announcement list using the GUI
I have a select list. I want to append a new item in italic
It's very simple. List<string> stringArr = new List<string>(); foreach (var item in db.IconTags) {
I'm trying to display the new dynamic list by clicking dynamic list. Why do
Currently the list item # appears on the right. If you remove the float
** I want one single list item to have fistname, last name and the
I have a list item with a button inside. When the button is shown,
I've got a list item with an image inside, for example: <ul> <li> <img></img>

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.