Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^9: How to add columns with new row name using perl from mysql query?

by Corion (Patriarch)
on Apr 06, 2017 at 13:31 UTC ( [id://1187278]=note: print w/replies, xml ) Need Help??


in reply to Re^8: How to add columns with new row name using perl from mysql query?
in thread How to add columns with new row name using perl from mysql query?

So, just add the alias and you're done.

Most likely, your SQL manual for your database will have the relevant information.

  • Comment on Re^9: How to add columns with new row name using perl from mysql query?

Replies are listed 'Best First'.
Re^10: How to add columns with new row name using perl from mysql query?
by finddata (Sexton) on Apr 06, 2017 at 13:40 UTC
    Am newbie in using alias how to use alias for this query?.I had google it but i didnt get good view.

      Have you looked in the documentation of your database? Certainly the syntax is explained there.

        select queue_name,jobs_pending,jobs_running from((select queue_name,jo +bs_pending,jobs_running from queues order by queue_name limit 5)union + all(select 'others',sum(jobs_pending) int as jobs_pending,sum(jobs_r +unning) as jobs_running from (select jobs_pending,jobs_running from q +ueues order by queue_name limit 0 offset 5 ) foo)) foo;
        The above thing now works for me.But the problem is others row not have the data type.So it prints NULL.How can i add data type along with 'others' row.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1187278]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (2)
As of 2024-04-20 03:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found