{"id":1967,"date":"2021-07-24T17:13:20","date_gmt":"2021-07-24T11:43:20","guid":{"rendered":"https:\/\/selfimagination.in\/tips\/?p=1967"},"modified":"2021-11-08T12:47:19","modified_gmt":"2021-11-08T07:17:19","slug":"mysql-row-to-column-interchange-trick","status":"publish","type":"post","link":"https:\/\/selfimagination.in\/tips\/mysql-row-to-column-interchange-trick\/","title":{"rendered":"MySQL Interchange Logic (Row to Column) &#038; (Column to Row )"},"content":{"rendered":"\n<p class=\"wp-block-zozuk-wphindi\">\u0907\u0938 Article \u092e\u0947\u0902 \u0939\u092e Interchange Logic \u0915\u094b 3 \u092a\u0949\u0907\u0902\u091f \u0938\u092e\u091d\u0947\u0902\u0917\u0947 <\/p>\n\n\n\n<p class=\"wp-block-zozuk-wphindi\">1. Rows to Columns Interchange Using <span id=\"291_TRN_1\">SQL<\/span> (SQL Row se Column kaise banaye?)<br>2. Rows to Columns Interchange Using Trigger (Trigger se Row se Column kaise banaye?)<br>3. Columns to Rows Interchange Using SQL (Column se row kaise banaye?) <br><\/p>\n\n\n\n<p class=\"wp-block-zozuk-wphindi\"><\/p>\n\n\n\n<p class=\"wp-block-zozuk-wphindi\"><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>1. Rows Into Columns Interchange Logic<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-zozuk-wphindi\">\u0915\u094b\u0908 \u092d\u0940 \u092a\u094d\u0930\u094b\u091c\u0947\u0915\u094d\u091f \u092e\u0947\u0902 \u0915\u093e\u0930\u094d\u092f \u0915\u0930\u0924\u0947 \u0938\u092e\u092f \u0939\u092e\u0947\u0902 \u0915\u094b\u0908 \u0930\u093f\u092a\u094b\u0930\u094d\u091f \u092f\u093e \u0915\u0941\u091b \u0907\u0938 \u092a\u094d\u0930\u0915\u093e\u0930 \u0938\u0947 Query \u0932\u0917\u0924\u0940 \u0939\u0948\u0902 \u091c\u093f\u0938\u092e\u0947 \u091c\u094b \u0921\u093e\u091f\u093e ROW \u092e\u0947\u0902 \u0939\u0948\u0902 \u0909\u0938\u0947 COLUMN \u092e\u0947\u0902 Change \u0915\u0930\u0928\u093e \u0939\u094b\u0924\u093e \u0939\u0948\u0902, \u0935\u0948\u0938\u0947 \u0924\u094b <strong>PIVOT<\/strong> \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930 \u092d\u0940 \u0906\u092a \u0907\u0938 \u092a\u094d\u0930\u0949\u092c\u094d\u0932\u092e \u0915\u094b Solve \u0915\u0930 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902 , \u092f\u0939\u093e\u0901 \u092a\u0930 \u0939\u092e Basic SQL \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930 \u0915\u0948\u0938\u0947 \u0907\u0938 \u0924\u0930\u0939 \u0915\u0940 problem \u0915\u094b Solve \u0915\u0930\u0924\u0947 \u0939\u0948\u0902 \u0906\u0907\u092f\u0947 \u0926\u0947\u0916\u0924\u0947 \u0939\u0948\u0902 <\/p>\n\n\n\n<p class=\"wp-block-zozuk-wphindi\">Ex: \u0939\u092e\u093e\u0930\u0947 \u092a\u093e\u0938 \u090f\u0915 \u091f\u0947\u092c\u0932 \u0939\u0948\u0902 \u091c\u093f\u0938\u092e\u0947 \u0915\u0940 student \u0915\u0940 \u092c\u0915\u093e\u092f\u093e \u092b\u0940 \u0915\u0947 \u092c\u093e\u0930\u0947 \u092e\u0947\u0902 \u091c\u093e\u0928\u0915\u093e\u0930\u0940 Store \u0939\u0948\u0902, \u091c\u094b \u0915\u0940 \u0907\u0938 \u092a\u094d\u0930\u0915\u093e\u0930 \u0939\u0948\u0902  <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"308\" height=\"260\" src=\"https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2021\/07\/DueFessTable.jpg?resize=308%2C260&#038;ssl=1\" alt=\"\" class=\"wp-image-1970\" srcset=\"https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2021\/07\/DueFessTable.jpg?w=308&amp;ssl=1 308w, https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2021\/07\/DueFessTable.jpg?resize=300%2C253&amp;ssl=1 300w\" sizes=\"auto, (max-width: 308px) 100vw, 308px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-zozuk-wphindi\">\u092f\u0939\u093e\u0901 \u092a\u0930 <strong>installment_no<\/strong> ROW \u092e\u0947\u0902 Store \u0939\u0948\u0902  \u0905\u092c \u0939\u092e \u090f\u0915 Query \u0938\u0947 Row \u0915\u0947 \u0921\u093e\u091f\u093e \u0915\u094b Column \u092e\u0947\u0902 \u0932\u0947 \u091c\u093e\u092f\u0947\u0902\u0917\u0947 <\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Split rows into columns in MySQL<\/strong><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"sql\" class=\"language-sql\">SELECT scholar_no, \nsum( (case installment_no when 1 then fee_amt else 0 end))  as  inst_1, \nsum( (case installment_no when 2 then fee_amt else 0 end))  as  inst_2, \nsum( (case installment_no when 3 then fee_amt else 0 end))  as  inst_3,\nsum( (case installment_no when 4 then fee_amt else 0 end))  as  inst_4\nfrom\nfee_due\ngroup by scholar_no<\/code><\/pre>\n\n\n\n<p class=\"wp-block-zozuk-wphindi\">\u092f\u0939\u093e\u0901 \u092a\u0930 \u0939\u092e\u0928\u0947 <strong>Aggregate Function<\/strong> \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u093f\u092f\u093e \u0939\u0948\u0902 , \u0914\u0930 \u092f\u0926\u093f \u0939\u092e Aggregate Function \u0915\u0947 \u0938\u093e\u0925 \u0915\u093f\u0938\u0940 \u0915\u0949\u0932\u092e \u0915\u094b \u0932\u093f\u0916\u0924\u0947 \u0939\u0948\u0902 \u0924\u094b \u0939\u092e\u0947\u0902 Group By \u092e\u0947\u0902 \u0909\u0928 \u0915\u0949\u0932\u092e \u0915\u0947 \u0928\u093e\u092e \u0932\u093f\u0916\u0928\u0947 \u0939\u094b\u0924\u0947 \u0939\u0948\u0902, \u0907\u0938\u0932\u093f\u090f \u0939\u092e\u0928\u0947 <strong>scholar_no<\/strong> \u0915\u094b <strong>Group By<\/strong> \u092e\u0947\u0902 \u0932\u093f\u0916\u093e \u0939\u0948\u0902 \u0964 \u0907\u0938 <strong>Query<\/strong> \u0915\u093e <strong>Output<\/strong> \u0907\u0938 \u092a\u094d\u0930\u0915\u093e\u0930 \u0939\u094b\u0917\u093e \u0964<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>This Example For Convert Rows into Column Without Pivot<\/strong><\/h2>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"325\" height=\"86\" src=\"https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2021\/07\/Row-to-Column-Format.jpg?resize=325%2C86&#038;ssl=1\" alt=\"Interchange Logic Rows into Columns\" class=\"wp-image-1975\" srcset=\"https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2021\/07\/Row-to-Column-Format.jpg?w=325&amp;ssl=1 325w, https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2021\/07\/Row-to-Column-Format.jpg?resize=300%2C79&amp;ssl=1 300w\" sizes=\"auto, (max-width: 325px) 100vw, 325px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-zozuk-wphindi\">\u092f\u0939\u093e\u0901 \u092a\u0930 \u0926\u0947\u0916\u093f\u092f\u0947 Installment_no \u0915\u093e \u0921\u093e\u091f\u093e 1,2,3,4 \u091c\u094b \u0915\u0940 <strong>Row<\/strong> \u092e\u0947\u0902 <strong>Store<\/strong> \u0925\u093e \u0909\u0938\u0947 <strong>Query<\/strong> \u091a\u0932\u093e \u0915\u0930 \u0939\u092e\u0928\u0947 \u0909\u0938\u0915\u0947 \u0932\u093f\u090f \u0905\u0932\u0917 &#8211; \u0905\u0932\u0917 \u0915\u0949\u0932\u092e \u092c\u0928\u093e \u0926\u093f\u090f \u0939\u0948\u0902, <\/p>\n\n\n\n<p class=\"wp-block-zozuk-wphindi\">\u092f\u0939 SQL <strong>Sybase, SQL Server, My SQL <\/strong> \u0914\u0930 \u092d\u0940 \u092c\u0939\u0941\u0924 \u0938\u0947 Database \u092e\u0947\u0902 \u0915\u093e\u0930\u094d\u092f \u0915\u0930 \u0938\u0915\u0924\u093e \u0939\u0948\u0902 \u0964<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a href=\"https:\/\/youtu.be\/17G0fkeQb9Q\" target=\"_blank\" rel=\"noopener\">Video \u0915\u0947 \u092e\u093e\u0927\u094d\u092f\u092e \u0938\u0947 \u0926\u0947\u0916\u0928\u0947 \u0915\u0947 \u0932\u093f\u090f \u092f\u0939\u093e \u0913\u0930 \u0915\u094d\u0932\u093f\u0915 \u0915\u0930\u0947 <\/a><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u0939\u092e\u093e\u0930\u0947 \u0905\u0928\u094d\u092f \u0906\u0930\u094d\u091f\u093f\u0915\u0932<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/selfimagination.in\/tips\/learn-c-basic-n-advance\/\">Learn C \u2013 \u0939\u093f\u0902\u0926\u0940 \u092e\u0947\u0902<\/a><\/li><li><a href=\"https:\/\/selfimagination.in\/tips\/mysql-aggregate-function-in-hindi\/\">MySQL Aggregate Function in Hindi<\/a><\/li><li><a href=\"https:\/\/selfimagination.in\/tips\/mysql-sys-exec-example-with-trigger\/\">MySQL SYS_EXEC Example With Trigger<\/a><\/li><li><a href=\"https:\/\/selfimagination.in\/tips\/get-post-method\/\">GET &amp; POST Method | Difference Between GET &amp; POST<\/a><\/li><li><a href=\"https:\/\/selfimagination.in\/tips\/php-validation-filter-var-preg_match\/\">PHP Validation | filter_var | preg_match<\/a><\/li><\/ul>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>2 . Rows Into Columns Interchange Using Trigger<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-zozuk-wphindi\">\u0907\u0938 Problem \u0915\u0947 solution \u0915\u0947 \u0932\u093f\u090f \u0939\u092e\u0947\u0902 \u0926\u094b \u091f\u0947\u092c\u0932 \u0932\u0917\u0947\u0917\u0940, \u092a\u0939\u0932\u0940 \u091c\u093f\u0938 \u091f\u0947\u092c\u0932 \u092e\u0947\u0902 Installation Number Row \u092e\u0947\u0902 \u0939\u0948\u0902 \u0914\u0930 \u0926\u0942\u0938\u0930\u0940 Table \u091c\u093f\u0938\u092e\u0947 Installation Number \u0915\u0947 \u0932\u093f\u090f \u0905\u0932\u0917 \u0905\u0932\u0917 \u0915\u0949\u0932\u092e \u092c\u0928\u0947 \u0939\u094b \u0964<\/p>\n\n\n\n<p class=\"wp-block-zozuk-wphindi\">\u0905\u092c \u0939\u092e\u0947\u0902 First \u091f\u0947\u092c\u0932 \u091c\u093f\u0938\u0938\u0947 \u0921\u093e\u091f\u093e \u0932\u0947 \u091c\u093e\u0928\u093e \u0939\u0948\u0902 \u0909\u0938 \u092a\u0930 3 \u091f\u094d\u0930\u093f\u0917\u0930 \u0932\u093f\u0916\u0928\u093e \u0939\u094b\u0902\u0917\u0947 <\/p>\n\n\n\n<p class=\"wp-block-zozuk-wphindi\">\u092a\u0939\u0932\u093e  Insert \u0915\u0947 \u0938\u092e\u092f,  \u0926\u0942\u0938\u0930\u093e Update \u0915\u0947 \u0938\u092e\u092f \u0914\u0930 \u0924\u0940\u0938\u0930\u093e Delete \u0915\u0947 \u0938\u092e\u092f <\/p>\n\n\n\n<p class=\"wp-block-zozuk-wphindi\"><strong>Insert \u0915\u0947 \u0938\u092e\u092f <\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u0907\u0928\u094d\u0938\u0930\u094d\u091f \u0915\u0947 \u0938\u092e\u092f \u0939\u092e\u0947\u0902 \u0938\u092c\u0938\u0947 \u092a\u0939\u0932\u0947 \u092f\u0939 \u0926\u0947\u0916\u0928\u093e \u0939\u094b\u0917\u093e \u0915\u0940 \u091c\u093f\u0938 \u0938\u094d\u0915\u0949\u0932\u0930 \u0928\u0902\u092c\u0930 \u0915\u0940 \u090f\u0902\u091f\u094d\u0930\u0940 \u0939\u094b \u0930\u0939\u0940 \u0939\u0948\u0902 \u0907\u0938 \u0938\u094d\u0915\u0949\u0932\u0930 \u0928\u0902\u092c\u0930 \u0914\u0930 \u0907\u0928\u094d\u0938\u091f\u0949\u0932\u092e\u0947\u0902\u091f \u092a\u0930 \u092f\u0926\u093f \u092a\u0939\u0932\u0947 \u0938\u0947 \u0921\u093e\u091f\u093e \u0939\u094b \u0924\u094b \u0909\u0938\u0915\u0940 \u0930\u093e\u0936\u093f \u0915\u094b \u0905\u092a\u0921\u0947\u091f \u0915\u0930\u0928\u093e<\/li><li>\u0926\u0942\u0938\u0930\u093e \u092f\u0926\u093f \u0921\u093e\u091f\u093e \u092a\u0939\u0932\u0947 \u0938\u0947 \u0928\u0939\u0940\u0902 \u0939\u094b \u0924\u094b \u0915\u0947\u0935\u0932 Insert \u0915\u0930\u0928\u093e<\/li><\/ul>\n\n\n\n<p class=\"wp-block-zozuk-wphindi\"><strong>Update \u0915\u0947 \u0938\u092e\u092f <\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u0905\u092a\u0921\u0947\u091f \u0915\u0947 \u0938\u092e\u092f \u0939\u092e\u0947\u0902 \u092a\u0941\u0930\u093e\u0928\u0940 \u0935\u0948\u0932\u094d\u092f\u0942 \u0915\u094b Minus \u0915\u0930\u0928\u093e \u0939\u0948\u0902<\/li><li>\u0914\u0930 \u0928\u092f\u0940 \u0935\u0948\u0932\u094d\u092f\u0942 \u092a\u0930 \u0926\u0947\u0916\u0928\u093e \u0939\u0948\u0902 \u0915\u0940 \u092a\u0939\u0932\u0947 \u0938\u0947 \u092f\u0939 \u0921\u093e\u091f\u093e \u0939\u094b \u0924\u094b Update \u0915\u0930\u0928\u093e \u0939\u0948\u0902 \u0914\u0930 \u0928\u0939\u0940\u0902 \u0939\u094b \u0924\u094b Insert \u0915\u0930\u0928\u093e \u0939\u0948\u0902<\/li><\/ul>\n\n\n\n<p class=\"wp-block-zozuk-wphindi\"><strong>Delete \u0915\u0947 \u0938\u092e\u092f <\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u0921\u093f\u0932\u0940\u091f \u0915\u0947 \u0938\u092e\u092f \u0939\u092e\u0947\u0902 \u0915\u0947\u0935\u0932 \u0935\u0948\u0932\u094d\u092f\u0942 \u0915\u094b Minus \u0915\u0930\u0928\u093e \u0939\u094b\u0924\u093e \u0939\u0948\u0902 \u0964<\/li><\/ul>\n\n\n\n<p class=\"wp-block-zozuk-wphindi\"><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"sql\" class=\"language-sql\">\/\/First Table \nCREATE TABLE IF NOT EXISTS `fee_due` (\n  `id` int(9) NOT NULL AUTO_INCREMENT,\n  `scholar_no` int(9) NOT NULL,\n  `installment_no` int(2) NOT NULL,\n  `fee_amt` decimal(9,2) NOT NULL,\n  PRIMARY KEY (`id`)\n) \n\n\/\/ Second Table Which is Update By Trigger\nCREATE TABLE IF NOT EXISTS `fee_due_col` (\n  `id` int(9) NOT NULL AUTO_INCREMENT,\n  `scholar_no` int(9) NOT NULL,\n  `inst_1` decimal(9,2) NOT NULL DEFAULT 0.00,\n  `inst_2` decimal(9,2) NOT NULL DEFAULT 0.00,\n  `inst_3` decimal(9,2) NOT NULL DEFAULT 0.00,\n  `inst_4` decimal(9,2) NOT NULL DEFAULT 0.00,\n  PRIMARY KEY (`scholar_no`),\n  UNIQUE KEY `id_idx` (`id`)\n)\n\n\/\/ After Insert \n\nCREATE TRIGGER `fee_due_ai` AFTER INSERT ON `fee_due`\n FOR EACH ROW BEGIN\n\n\nif (new.installment_no = 1 ) THEN\n\n\n    insert into fee_due_col (scholar_no, inst_1) value (new.scholar_no, new.fee_amt)\n    on duplicate key update inst_1 = inst_1 + new.fee_amt;\n\nelseif (new.installment_no = 2 ) THEN\n\n    insert into fee_due_col (scholar_no, inst_2) value (new.scholar_no, new.fee_amt)\n    on duplicate key update inst_2 = inst_2 + new.fee_amt;\n    \nelseif (new.installment_no = 3 ) THEN\n\n    insert into fee_due_col (scholar_no, inst_3) value (new.scholar_no, new.fee_amt)\n    on duplicate key update inst_3 = inst_3 + new.fee_amt\n;\n    \nELSE\n\n    insert into fee_due_col (scholar_no, inst_4) value (new.scholar_no, new.fee_amt)\n    on duplicate key update inst_4 = inst_4 + new.fee_amt;\n   \n\nend IF;\n\n\n\nEND\n\n\n\/\/After Update\n\nCREATE TRIGGER `fee_due_au` AFTER UPDATE ON `fee_due`\n FOR EACH ROW BEGIN\n\nif (old.installment_no = 1 ) THEN\n   update fee_due_col set inst_1 = inst_1 - old.fee_amt\n   where scholar_no = old.scholar_no;\nelseif (old.installment_no = 2 ) THEN\n   update fee_due_col set inst_2 = inst_2 - old.fee_amt\n   where scholar_no = old.scholar_no;\nelseif (old.installment_no = 3 ) THEN\n   update fee_due_col set inst_3 = inst_3 - old.fee_amt\n   where scholar_no = old.scholar_no;\nELSE\n   update fee_due_col set inst_4 = inst_4 - old.fee_amt\n   where scholar_no = old.scholar_no;\nEND IF;\n\n\n\n\nif (new.installment_no = 1 ) THEN\n\n    insert into fee_due_col (scholar_no, inst_1) value (new.scholar_no, new.fee_amt)\n    on duplicate key update inst_1 = inst_1 + new.fee_amt\n    ;\n\nelseif (new.installment_no = 2 ) THEN\n\n    insert into fee_due_col (scholar_no, inst_2) value (new.scholar_no, new.fee_amt)\n    on duplicate key update inst_2 = inst_2 + new.fee_amt\n    ;\n    \nelseif (new.installment_no = 3 ) THEN\n\n    insert into fee_due_col (scholar_no, inst_3) value (new.scholar_no, new.fee_amt)\n    on duplicate key update inst_3 = inst_3 + new.fee_amt\n    ;\n    \nELSE\n    insert into fee_due_col (scholar_no, inst_4) value (new.scholar_no, new.fee_amt)\n    on duplicate key update inst_4 = inst_4 + new.fee_amt\n    ;\n   \n\nend IF;\n\n\n\nEND\n\n\/\/After Delete\n\nCREATE TRIGGER `fee_due_ad` AFTER DELETE ON `fee_due`\n FOR EACH ROW BEGIN\n\nif (old.installment_no = 1 ) THEN\n   update fee_due_col set inst_1 = inst_1 - old.fee_amt\n   where scholar_no = old.scholar_no;\nelseif (old.installment_no = 2 ) THEN\n   update fee_due_col set inst_2 = inst_2 - old.fee_amt\n   where scholar_no = old.scholar_no;\nelseif (old.installment_no = 3 ) THEN\n   update fee_due_col set inst_3 = inst_3 - old.fee_amt\n   where scholar_no = old.scholar_no;\nELSE\n   update fee_due_col set inst_4 = inst_4 - old.fee_amt\n   where scholar_no = old.scholar_no;\nEND IF;\n\n\nEND\n\n\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a href=\"https:\/\/youtu.be\/8x4PPRsp8_g\" target=\"_blank\" rel=\"noopener\">Video \u0915\u0947 \u092e\u093e\u0927\u094d\u092f\u092e \u0938\u0947 \u0926\u0947\u0916\u0928\u0947 \u0915\u0947 \u0932\u093f\u090f \u092f\u0939\u093e \u092a\u0930 \u0915\u094d\u0932\u093f\u0915 \u0915\u0930\u0947 <\/a><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>3. Columns Into Rows Interchange Logic <\/strong><\/h2>\n\n\n\n<p class=\"wp-block-zozuk-wphindi\">\u0926\u0947\u0916\u093f\u092f\u0947 \u092f\u0939\u093e\u0901 \u092a\u0930 \u0939\u092e\u0928\u0947 \u090f\u0915 \u091f\u0947\u092c\u0932 \u092c\u0928\u093e\u0908 \u0939\u0948\u0902 \u091c\u093f\u0938\u092e\u0947 installment amount \u0915\u0947 \u0932\u093f\u090f \u0905\u0932\u0917 \u0905\u0932\u0917 column \u092c\u0928\u093e \u0932\u093f\u090f \u0939\u0948\u0902 , \u0905\u092c \u0907\u0938\u0947 \u0939\u092e SQL \u0915\u0947 \u0926\u094d\u0935\u093e\u0930\u093e  \u0938\u092d\u0940 Installment \u0915\u094b \u090f\u0915 \u0915\u0949\u0932\u092e \u092e\u0947\u0902 \u0932\u0947 \u0906\u090f\u0902\u0917\u0947, \u0914\u0930 \u090f\u0915 Dummy Column \u092c\u0928\u093e\u090f\u0902\u0917\u0947 \u091c\u093f\u0938\u092e\u0947 \u0939\u092e Installment No \u0915\u094b \u0926\u093f\u0916\u093e\u090f\u0902\u0917\u0947 \u0964Table \u0907\u0938 \u092a\u094d\u0930\u0915\u093e\u0930 \u0939\u0948\u0902 \u0964 <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"562\" height=\"105\" src=\"https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2021\/07\/image.png?resize=562%2C105&#038;ssl=1\" alt=\"\" class=\"wp-image-1989\" srcset=\"https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2021\/07\/image.png?w=562&amp;ssl=1 562w, https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2021\/07\/image.png?resize=300%2C56&amp;ssl=1 300w, https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2021\/07\/image.png?resize=465%2C87&amp;ssl=1 465w\" sizes=\"auto, (max-width: 562px) 100vw, 562px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-zozuk-wphindi\">\u0905\u092c \u0907\u0938 SQL \u0938\u0947 \u0906\u092a Union All \u0915\u0940 \u0938\u0939\u093e\u092f\u0924\u093e \u0938\u0947 \u090f\u0915 \u0939\u0940 \u091f\u0947\u092c\u0932 \u0915\u0947 \u0905\u0932\u0917 \u0905\u0932\u0917 Column \u0915\u094b \u091c\u094b\u095c \u0915\u0930 Row \u092c\u0928\u093e \u0932\u0947\u0902\u0917\u0947 \u0964<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"sql\" class=\"language-sql\">SELECT scholar_no, inst_no, sum(ins_amt) as inst_amt\nFROM\n(\n    SELECT scholar_no, inst_1 as ins_amt, 1 as inst_no FROM `fee_due_col` \n    UNION ALL\n    SELECT scholar_no, inst_2 as ins_amt, 2 as inst_no FROM `fee_due_col` \n    UNION ALL\n    SELECT scholar_no, inst_3 as ins_amt, 3 as inst_no FROM `fee_due_col` \n    UNION ALL\n    SELECT scholar_no, inst_4 as ins_amt, 4 as inst_no FROM `fee_due_col` \n) a\nGROUP BY scholar_no, inst_no<\/code><\/pre>\n\n\n\n<p class=\"wp-block-zozuk-wphindi\">\u0907\u0938 SQL \u0915\u094b Execute \u0915\u0930\u0928\u0947 \u0915\u0947 \u092c\u093e\u0926 \u0906\u092a\u0915\u094b \u0915\u0941\u091b \u0907\u0938 \u0924\u0930\u0939 \u0938\u0947 Result \u0926\u093f\u0916\u093e\u0908 \u0926\u0947\u0917\u093e <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"232\" height=\"181\" src=\"https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2021\/07\/Column-to-Row.jpg?resize=232%2C181&#038;ssl=1\" alt=\"Interchange Logic Columns into Rows\" class=\"wp-image-1997\"\/><\/figure>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><a href=\"https:\/\/youtu.be\/42ce64IPk1g\" target=\"_blank\" rel=\"noopener\">Video \u0915\u0947 \u092e\u093e\u0927\u094d\u092f\u092e \u0938\u0947 \u0926\u0947\u0916\u0928\u0947 \u0915\u0947 \u0932\u093f\u090f \u092f\u0939 \u092a\u0930 \u0915\u094d\u0932\u093f\u0915 \u0915\u0930\u0947 <\/a><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p class=\"wp-block-zozuk-wphindi\">\u0926\u094b\u0938\u094d\u0924\u094b\u0902 \u0907\u0938 \u0906\u0930\u094d\u091f\u093f\u0915\u0932 \u092e\u0947\u0902 \u0939\u092e\u0928\u0947 Row to Column \u0914\u0930 Column to Row \u092e\u0947\u0902 \u092c\u0926\u0932\u0928\u093e SQL \u0913\u0930 Trigger \u0938\u0947 \u0938\u092e\u091d\u093e \u0939\u0948\u0902 , \u0906\u0936\u093e \u0939\u0948\u0902 \u092e\u0941\u091d\u0947 \u0915\u0940 \u0906\u092a\u0915\u094b \u0920\u0940\u0915 \u0938\u0947 \u0938\u092e\u091d \u092e\u0947 \u0906 \u0917\u092f\u093e \u0939\u094b\u0917\u093e \u0964 <\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. Rows Into Columns Interchange Logic Split rows into columns in MySQL This Example For Convert Rows into Column Without Pivot Video \u0915\u0947 \u092e\u093e\u0927\u094d\u092f\u092e \u0938\u0947 \u0926\u0947\u0916\u0928\u0947 \u0915\u0947 \u0932\u093f\u090f \u092f\u0939\u093e \u0913\u0930 \u0915\u094d\u0932\u093f\u0915 \u0915\u0930\u0947 \u0939\u092e\u093e\u0930\u0947 \u0905\u0928\u094d\u092f \u0906\u0930\u094d\u091f\u093f\u0915\u0932 Learn C \u2013 \u0939\u093f\u0902\u0926\u0940 \u092e\u0947\u0902 MySQL Aggregate Function in Hindi MySQL SYS_EXEC Example With Trigger GET &amp; POST Method | [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1977,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[5],"tags":[],"class_list":["post-1967","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-mysql"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/i0.wp.com\/selfimagination.in\/tips\/wp-content\/uploads\/2021\/07\/mysql-row-to-column-interchange.jpg?fit=1200%2C628&ssl=1","_links":{"self":[{"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/posts\/1967","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/comments?post=1967"}],"version-history":[{"count":42,"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/posts\/1967\/revisions"}],"predecessor-version":[{"id":5148,"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/posts\/1967\/revisions\/5148"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/media\/1977"}],"wp:attachment":[{"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/media?parent=1967"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/categories?post=1967"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/selfimagination.in\/tips\/wp-json\/wp\/v2\/tags?post=1967"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}