Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
🚀 GOOGLE AI PRO 18 MONTHS ACTIVATION 🚀
sayuru bandara
Updated:
Today at 5:34 PM
Pure VPN - Up to 27 Months
vgp
Updated:
Friday at 8:10 AM
එක පැකේජ් එකයි මාසෙටම Unlimited Internet. තාමත් DATA CARD දාන්න සල්ලි වියදම් කරනවද? අඩුම මිලට අපෙන්.
sayuru bandara
Updated:
Jun 2, 2026
Ad icon
ඉන්ටර්නෙට් එකෙන් හරියටම සල්ලි හොයන්න සහ Success වෙන්න කැමතිද? 🚀 (E-Money & Success Stories)
siri sumana
Updated:
May 30, 2026
Gemini AI PRO 18 months Offer
Hawaka
Updated:
May 27, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
Computers & Internet
Software Development
MySQL Pivot Table
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="ranga_uoc" data-source="post: 23457400" data-attributes="member: 23698"><p>SET @sql = NULL;</p><p></p><p>SELECT</p><p> GROUP_CONCAT(DISTINCT</p><p> CONCAT(</p><p> 'SUM(CASE WHEN MonthYear = ''',</p><p> MonthYear,</p><p> ''' THEN amt ELSE 0 END) AS ',</p><p> MonthYear</p><p> )</p><p> ) INTO @sql</p><p>FROM (</p><p> SELECT</p><p> stu_id,</p><p> DATE_FORMAT(date, '%b_%y') MonthYear,</p><p> amt</p><p> FROM fees</p><p> WHERE date BETWEEN CAST('2017-01-01' AS DATE) AND CAST('2018-07-31' AS DATE)</p><p> ORDER BY date</p><p>) src;</p><p></p><p>SET @sql = CONCAT("SELECT stu_id, ", @sql, "</p><p> FROM (</p><p> SELECT</p><p> stu_id,</p><p> DATE_FORMAT(date, '%b_%y') MonthYear,</p><p> amt</p><p> FROM fees</p><p> WHERE date BETWEEN CAST('2013-01-01' AS DATE) AND CAST('2018-07-31' AS DATE)</p><p> ORDER BY date</p><p> ) src</p><p> GROUP BY stu_id");</p><p></p><p>PREPARE stmt FROM @sql;</p><p>EXECUTE stmt;</p><p>DEALLOCATE PREPARE stmt;</p></blockquote><p></p>
[QUOTE="ranga_uoc, post: 23457400, member: 23698"] SET @sql = NULL; SELECT GROUP_CONCAT(DISTINCT CONCAT( 'SUM(CASE WHEN MonthYear = ''', MonthYear, ''' THEN amt ELSE 0 END) AS ', MonthYear ) ) INTO @sql FROM ( SELECT stu_id, DATE_FORMAT(date, '%b_%y') MonthYear, amt FROM fees WHERE date BETWEEN CAST('2017-01-01' AS DATE) AND CAST('2018-07-31' AS DATE) ORDER BY date ) src; SET @sql = CONCAT("SELECT stu_id, ", @sql, " FROM ( SELECT stu_id, DATE_FORMAT(date, '%b_%y') MonthYear, amt FROM fees WHERE date BETWEEN CAST('2013-01-01' AS DATE) AND CAST('2018-07-31' AS DATE) ORDER BY date ) src GROUP BY stu_id"); PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt; [/QUOTE]
Insert quotes…
Verification
Dahaya deken beduwama keeyada?
Post reply
Top
Bottom