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

  • SEARCH
  • Home
  • 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 9203515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:29:25+00:00 2026-06-17T23:29:25+00:00

I have the MySQL query: SELECT transporttype, concat(MONTHNAME(STR_TO_DATE(month, ‘%m’)), ‘ ‘, year) AS `month`,

  • 0

I have the MySQL query:

SELECT
transporttype,
concat(MONTHNAME(STR_TO_DATE(month, '%m')), ' ', year) AS `month`,
count(loadnumber) AS loads
FROM v2ReportingTable
WHERE (transporttype not in ('Extrusions-LongDistance','Extrusions-Shuttle') and urgent='no')
GROUP BY (concat(MONTHNAME(STR_TO_DATE(month, '%m')),' ',year)),transporttype
ORDER BY (concat(MONTHNAME(STR_TO_DATE(month, '%m')),' ',year)), transporttype

that produces the below output:

enter image description here

I want to display the results in column format, as below:
enter image description here

How can I modify my query to display the results as such.

Assistance is appreciated as always

  • 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-17T23:29:27+00:00Added an answer on June 17, 2026 at 11:29 pm
    SELECT  `month`,
            MAX(CASE WHEN transporttype = 'Inbound' THEN loads ELSE NULL END) `Inbound`,
            MAX(CASE WHEN transporttype = 'LocalGauteng' THEN loads ELSE NULL END) `LocalGauteng`,
            MAX(CASE WHEN transporttype = 'LongDistance' THEN loads ELSE NULL END) `LongDistance`,
            MAX(CASE WHEN transporttype = 'Shuttle-company1' THEN loads ELSE NULL END) `Shuttle-company1`,
            MAX(CASE WHEN transporttype = 'Shuttle-company2' THEN loads ELSE NULL END) `Shuttle-company2`,
            MAX(CASE WHEN transporttype = 'stores' THEN loads ELSE NULL END) `stores`,
            MAX(CASE WHEN transporttype = 'returns' THEN loads ELSE NULL END) `returns`,
            MAX(CASE WHEN transporttype = 'localkzn' THEN loads ELSE NULL END) `localkzn`
    FROM
        (
            SELECT  transporttype,
                    CONCAT(MONTHNAME(STR_TO_DATE(month, '%m')), ' ', year) AS `month`,
                    COUNT(loadnumber) AS loads
            FROM    v2ReportingTable
            WHERE   transporttype not in ('Extrusions-LongDistance','Extrusions-Shuttle') AND
                    urgent='no'
            GROUP BY (concat(MONTHNAME(STR_TO_DATE(month, '%m')),' ',year)), transporttype
        ) aa
    GROUP BY `month`
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple query that produces the below results: SELECT month,transporttype,count(transporttype) as loads
I have this MySql query: SELECT YEAR(date), MONTHNAME(date), SUM(block_time) FROM flights WHERE operator =
I have a mysql query like this: $topicreplycount = mysql_query('SELECT COUNT(DISTINCT post_msg_id) FROM phpbb_attachments
I have this MySQL query: SELECT DAYOFYEAR(`date`) AS d, COUNT(*) FROM `orders` WHERE `hasPaid`
I have this MySQL query SELECT count( * ) AS total FROM `orders` o,
I have a MySQL query: SELECT px.player, px.pos, px.year, px.age, px.gp, px.goals, px.assists ,
I have an mysql query: SELECT count(*) as `present_days` FROM tbl_intime_status WHERE employee_status =
I have MYSQL query SELECT WEEKDAY(CreatedDate), COUNT(CreatedDate), CreatedDate FROM bug_List GROUP BY WEEKDAY(CreatedDate) But
I have this mysql query: SELECT CONCAT(u.lastname, ', ', u.firstname) AS Name, start.timestamp start,
I have a MySQL query: SELECT COUNT(*) AS total, DATE_FORMAT(event.serverTime,'%Y-%m-%d') AS sdate FROM event

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.