Solving SQL Query | Rows to Column in SQL

Поделиться
HTML-код
  • Опубликовано: 25 июл 2024
  • In this video, we will solve an SQL Query where we will need to transform data from rows to column.
    We can transform data from rows to column in SQL using PIVOT operator but not all RDBMS supports PIVOT. Microsoft SQL Server and Oracle supports PIVOT operator, whereas in PostgreSQL, we can transform rows to column using CROSSTAB function. Similarly in MySQL database, rows to column transformation can be done using the CASE statement.
    Hence in this video, we shall first look at the SQL query problem statement. We understand the input data and also understand the expected output. After this we shall write SQL query to solve this problem using PIVOT in Microsoft SQL Server and in Oracle.
    We shall then solve the same problem in PostgreSQL database using CROSSTAB function. Finally we shall also solve this query in MySQL database using the CASE statement.
    All the datasets, scripts and SQL queries used in this video can be downloaded from my blog and from my discord channel. Links below:
    Blog: techtfq.com/video/solving-sql...
    Discord: / discord
    If you would like to share any interesting SQL query with me so that I can make a video about it then do share them in the email below:
    Email id: techtfq@gmail.com
    Timestamp:
    00:00 Intro
    01:58 Understanding the SQL Query Problem statement
    04:20 Solving SQL Query in Microsoft SQL Server using PIVOT
    26:59 Solving SQL Query in Oracle using PIVOT
    32:46 Solving SQL Query in PostgreSQL using CROSSTAB
    55:31 Solving SQL Query in MySQL using CASE statement
    🔴 WATCH MORE VIDEOS HERE 👇
    ✅ SQL Tutorial - Basic concepts:
    • SQL Tutorial - Basic c...
    ✅ SQL Tutorial - Intermediate concepts:
    • SQL Tutorial - Interme...
    ✅ SQL Tutorial - Advance concepts:
    • SQL Tutorial - Advance...
    ✅ Practice Solving Basic SQL Queries:
    • Practice Solving BASIC...
    ✅ Practice Solving Intermediate SQL Queries:
    • Practice Solving INTER...
    ✅ Practice Solving Complex SQL Queries:
    • Practice Solving COMPL...
    ✅ Data Analytics Career guidance:
    • Data Analytics career ...
    ✅ SQL Course, SQL Training Platform Recommendations:
    • SQL Course / Training
    ✅ Python Tutorial:
    • Python Tutorial
    THANK YOU,
    Thoufiq

Комментарии • 187

  • @TheVaibhavdang
    @TheVaibhavdang 2 года назад +16

    Your content is what I am following from my initial days of learning sql. If possible please make more practise videos on sql with concepts every week/weekend so that our logic buildng can increase week by week. Thanks for the good content.

  • @Nizam_Ul_Mulk
    @Nizam_Ul_Mulk 3 месяца назад +1

    Bro you are one of the best trainers I could ever come across. To the point and the crystal clear. Thanks one again.

  • @MOTIVAO
    @MOTIVAO Год назад +1

    Your videos are quite incredible, thank you Thoufiq for your patience and knowledge.

  • @nataliebear9011
    @nataliebear9011 Год назад

    This is the best crosstab explanation I've seen. Thank you!!!

  • @SantanuRoy-oq2nv
    @SantanuRoy-oq2nv Год назад

    Taufiq sir, absolutely clear the "without ORDER BY clause in postgre SQL Crosstab"...what ever customer is visible as per the sequence , CROSSTAB is grouping those visible data. That's why ORDER BY is mandatory otherwise this weird type data will be show. Thank you sir

  • @mahamuthashameem3250
    @mahamuthashameem3250 Год назад

    till i watched this video, i was scared about pivot query, now i can understand it easily. thank yo so much for the video

  • @pw6048
    @pw6048 2 года назад +4

    Good video, but for SQL Server i would recommend you look at the GROUPING SETS command.
    With that you can rewrite your query to below :
    When using "set statistics time on;" you can see it beeing a lot faster.
    ;with inner_data as
    (
    select
    customer_id as Customer
    ,format(sales_date, 'MMM-yy') as sales_date
    ,cast(replace(amount, '$', '') as int) as amount
    from sales_data
    )
    select *
    from (
    select
    isnull(Customer, 'Total') as Customer,
    isnull(sales_date, 'Total') as sales_date,
    case when sign(sum(amount)) = -1 then concat('(', ABS(sum(amount)), ')$') else concat(sum(amount), '$') end as amount
    from (
    SELECT a.Customer, b.sales_date, 0 as amount
    from
    inner_data a inner join
    inner_data b
    on a.Customer b.Customer and a.sales_date b.sales_date
    union all
    select
    Customer
    ,sales_date
    ,amount
    from inner_data ) a
    group by GROUPING SETS( (Customer, sales_date), (Customer),(sales_date))
    ) as sales
    pivot
    (
    max(amount)
    for sales_date in ([Jan-21], [Feb-21], [Mar-21], [Apr-21]
    ,[May-21], [Jun-21], [Jul-21], [Aug-21]
    ,[Sep-21], [Oct-21], [Nov-21], [Dec-21],[Total])
    ) as pivot_table

  • @kushalbaral8551
    @kushalbaral8551 Год назад

    Great content, helped with exactly what I needed for my current task at work. Thanks a lot !

  • @samadixyachine8422
    @samadixyachine8422 Год назад +2

    Although i am not an English speaker, that does not prevent me from following you. It is very well explained with well chosen examples.
    I learned a lot thanks to you. Believe me you are the best. I copied the exact same query using crosstab and when i added the second
    argument i got the error : column ("Jan-21") does not exist. I hope you can explain the origin of the problem to me. GREAT THANKS
    (i replaced ("Jan-21") with (' 'Jan-21' ') and it worked)

  • @bala9535
    @bala9535 2 года назад +1

    Thank you so much... helping multi tools at same time...

  • @bobhutchins557
    @bobhutchins557 2 года назад +4

    What an outstanding video! Ver well done! Thank you for putting it together. I have a question, though. I'm primarily a MySQL users but also use SQL Server. How could we set this up to be more dynamic? For example, let's say your column table covered 24 months and had 5 customers. Instead of writing out 24 lines of code each time (1 for each column) and then 24 lines multiple times, is there a way to write much fewer lines using variables, loops and a WITH clause? Thanks again - your videos have taught me so, so much!

  • @olganikitochkina8526
    @olganikitochkina8526 3 месяца назад +1

    This is the best explanation! Thank you so much ❤

  • @karunakaranr2473
    @karunakaranr2473 Год назад

    Very helpful and thank you for your time and effort to make this excellent video.

  • @Anonymous_it_is
    @Anonymous_it_is 2 года назад +12

    Everytime you upload a new video, it brings abundance of knowledge in our lives. Thanks for this quality content.
    Maza aa jata hai aapka explanation sunke😁
    Please consider making videos on topics such as Indexing(in depth) and database designing if possible.

    • @techTFQ
      @techTFQ  2 года назад

      Thank you Rohit..
      Very happy to read your positive feedback ❤️

  • @sohailahmed3503
    @sohailahmed3503 Год назад

    Garrett Evans Wow thank you Garrett, you've made my day!

  • @LuLu-in3ix
    @LuLu-in3ix 3 месяца назад +1

    your video is very helpful for me. thank you. 👍

  • @qurdedu4032
    @qurdedu4032 2 года назад +1

    Tofik, you are legend!

  • @DHARMYOGCOM
    @DHARMYOGCOM 2 года назад +2

    this is a great one. thanks. i always wanted to do pivot queries. never really got around to it. now i got to learn it with my current project. very helpful video. thanks

    • @DHARMYOGCOM
      @DHARMYOGCOM 2 года назад

      thanks again. I just completed my report. Just have few little things to add but this video was very handy.

  • @adzplus1
    @adzplus1 2 года назад

    Awesome. Great video! Much helpful

  • @abhijeetwadkar2564
    @abhijeetwadkar2564 2 года назад +1

    Just wanted to say Thanks!!! Your sql joins video helped me crack my first tech interview. Kep up the good work brother.....

    • @techTFQ
      @techTFQ  2 года назад

      thank you, Great to hear Abhijeet!

  • @pitou00
    @pitou00 Год назад

    that was some useful stuff man, thankyou so much.
    mark my words "im going to get a data analyst job soon " and you are playing very important role in my journey.

    • @nada-rw6iy
      @nada-rw6iy 3 месяца назад

      I hope you got the job you wanted, any updates? I just started to understand the fundamentals of data engineering and I would love to hear how your journey is going and what helped you the most

  • @sandeepkhawas3367
    @sandeepkhawas3367 2 года назад +1

    I m so thankful to you brother....i must say video is very informative which is helping me to increase my skills on SQL...!! 👍

    • @techTFQ
      @techTFQ  2 года назад

      thank you Sandeep :)

  • @santoshkumarchannel8087
    @santoshkumarchannel8087 Год назад

    I also searching the same....But finally got from you
    Thank you

  • @nishantgupta2747
    @nishantgupta2747 2 года назад

    Hi Taufiq Just one word you are the best !!!! when it comes to sql

  • @IainMace
    @IainMace 2 года назад +3

    Outstanding. worked perfectly (for MySql). Thanks heaps

    • @techTFQ
      @techTFQ  2 года назад

      Glad to hear that

  • @likitha-sneha
    @likitha-sneha Год назад

    Thanks for the explanation. Ur explanations are crystal clear.
    I subscribed to ur channel..☺️

  • @mistypokeman3261
    @mistypokeman3261 2 года назад

    Hi, your videos are very helpful. Could you please upload the data sets you used in this video? I've checked in discord but I did not find any. Appreciate all your efforts 👍

  • @kancharalaparameshwarreddy3837
    @kancharalaparameshwarreddy3837 2 года назад +2

    Good video sir it is very help full and iam alway thankful to you sir ,sir kindly provide every week one imortant video

    • @techTFQ
      @techTFQ  2 года назад

      Thank you bro..
      And sure will try doing it bro

  • @user-sy4mp8hq6i
    @user-sy4mp8hq6i Год назад

    This video saved me! Thank you sir.

  • @maliktauqeer690
    @maliktauqeer690 Год назад

    Good video.
    You can wrap base query in (Double Dollar) $$ SUBQUERY $$ for postgres. Then you don't need to escape single quotes and makes it easy to read and write subquery.

  • @crazydot81
    @crazydot81 2 года назад +1

    Awesome explanation! As always. Great thanks!

    • @techTFQ
      @techTFQ  2 года назад

      Glad you liked it :)

  • @faranbaig6486
    @faranbaig6486 Год назад +2

    Thanks for the clarity Taufiq! I'm wondering if Crosstab allows date ranges to be selected dynamically. Instead of hard coding the months, is there a way for it to pick up whatever months the data has?

  • @anandpaulmangalam2192
    @anandpaulmangalam2192 Год назад +1

    Tf...awesome and great work. Although I have been writing SQL for several years, i could learn few new tips and tricks from you. I have a suggestion. Can you come up with a video that shows how to calculate cumulative totals and average totals on a rolling window. for e.g i need to calculate a 9 quarter ( 27months) average balance and cumulative losses. I have seen your window function video but that video lacks a real life problem solving component

  • @Christsermons
    @Christsermons 11 месяцев назад

    Great one thanks boss

  • @user-fc5vp8ij3n
    @user-fc5vp8ij3n Год назад

    Hello Sir,
    Very good example about transpose method in SQL using PIVOT as well as its equivalent in other RDBMS.
    Kindly clarify whether there is any method to make IN part in pivot dynamic instead of hardcoding.
    Thank you

  • @martinberger365
    @martinberger365 4 месяца назад

    You are a Big treasure, bro. ❤

  • @jawilson61
    @jawilson61 11 месяцев назад

    Really cool stuff

  • @jarodelaro
    @jarodelaro Год назад +1

    Mannnn you are simply the best ever, thanks so much, it helps a lottttttttttt!!!!

    • @techTFQ
      @techTFQ  Год назад

      Glad to hear that ☺️

  • @samiali5833
    @samiali5833 Год назад

    You have great content

  • @cooldwnload
    @cooldwnload 10 месяцев назад

    good work 👍

  • @grow_your_faith
    @grow_your_faith Год назад

    Great work techTFQ

  • @sonalivv
    @sonalivv 2 года назад +4

    This was a great video! I also loved how well you presented it, explaining every little detail. That way it is easy to remember the syntax. Thank you!! This was super helpful. Earlier I used to do sum() or max() to get a pivot output in postgres. crosstab will make my life a lot easier.
    One question - Is there a way we can dynamically populate the values for "as" and "values". For instance, instead of months, I have a list of products (which is dynamically populated) and I want to pivot customer against products. Is this possible in postgres?

    • @techTFQ
      @techTFQ  2 года назад +2

      Thank you 🙏🏼
      Instead of values you can provide an sql query as the second argument in crosstab..
      But this query should just return 1 column

    • @sonalivv
      @sonalivv 2 года назад +1

      @@techTFQ Thank you!! I will try this 🙏🏼

  • @vablestory2.0
    @vablestory2.0 Год назад

    awesome taufiq....you are a star

  • @ramakumarguntamadugu1299
    @ramakumarguntamadugu1299 2 года назад +1

    Great 👍 content as always 👌 thank you

    • @techTFQ
      @techTFQ  2 года назад

      Glad you liked it buddy

  • @babun4915
    @babun4915 Год назад

    Great work!
    Can we have a content with the comparison of oracle and ms sql ... that helps in migration of entire oracle to ms sql in terms of simple query to stored procedures

  • @abdullahyahya2471
    @abdullahyahya2471 2 года назад

    Great Video.
    Love you. #noHomo.

  • @obbubhanuchandra9729
    @obbubhanuchandra9729 2 года назад

    Do video to PLSQL real- time querys bro
    This video you do is help many persons bro

  • @arefbegh5298
    @arefbegh5298 5 месяцев назад

    Tqsm sir ❤️❤️

  • @Braiam
    @Braiam 2 года назад +1

    While useful this video confirms one of my believes: that pivoting on the database has the potential to be messy, and it's best dealt with in the application.

  • @AliBuKarrar
    @AliBuKarrar 5 месяцев назад

    Thank you so much! Just a quick note, in oracle we can use coalesce.

  • @kaushikbhide9387
    @kaushikbhide9387 2 года назад +1

    Thank You 👏👏 great content

    • @techTFQ
      @techTFQ  2 года назад +1

      Glad you think so!

  • @agustinagarciaguevara9923
    @agustinagarciaguevara9923 2 года назад

    Hi!! Thank you so much for this content, it's very useful and well explained.
    I'm trying to do exactly the same query you do on the first part of the video, and for some reason the pivot is not recognizing one of the values in that column. Have you had a similar problem?

  • @zemichal
    @zemichal Год назад

    thank you, subbed :)

  • @amitpandey9222
    @amitpandey9222 2 года назад +2

    Your every content are amazing and very well explained.Can you please create playlist around SQL query tuning and performance?

    • @techTFQ
      @techTFQ  2 года назад +1

      Thank you Amit , glad you like them..
      And noted on the suggestion

    • @amitpandey9222
      @amitpandey9222 2 года назад

      @@techTFQ thank you

  • @hanshubassa9735
    @hanshubassa9735 2 года назад +1

    Great explanation sir

    • @techTFQ
      @techTFQ  2 года назад

      Thank you buddy

  • @padmavathisonnaila6600
    @padmavathisonnaila6600 2 года назад

    Hi your videos are very helpful to me and I m begginer bit confused what is the difference between mysql,sql server, oracle,posgresql,plsql can u make a video on it please. Thank you in advance

  • @arunv1909
    @arunv1909 2 года назад +1

    honestly thank you for the video , but i learnt sub query in a different way , and you adding alias name in front and few things made me confuse a bit tbh , i understood the concept , thank you

    • @techTFQ
      @techTFQ  2 года назад

      thanks but don't confuse this with subquery. Ive made separate video for subquery.

    • @arunv1909
      @arunv1909 2 года назад +1

      @@techTFQ but you wont call this a subquery? ohh , i thought the end part as corelated subquery

    • @techTFQ
      @techTFQ  2 года назад +1

      This is the syntax for pivot operator..

  • @majidrooinparvizi8649
    @majidrooinparvizi8649 9 месяцев назад +1

    Following and enjoying your videos. But in these cases, isn't it just much easier and faster to do these transformations in Excel and import the results into sequel tables for further analysis if needed?

  • @srh1034
    @srh1034 Месяц назад

    @techtfq: Of all your videos this one is the most confusing and messy! Just jumping from here to there! Wish you could do more organized considering how good you are in explaining complex matters in simple ways!

  • @martinsenobong9241
    @martinsenobong9241 8 месяцев назад

    Great recourse for learning SQL

    • @techTFQ
      @techTFQ  7 месяцев назад

      Thank you ☺️

  • @innominatesoloist1597
    @innominatesoloist1597 Год назад +1

    My God...........so many learnings in just one video

  • @Mayank-jw9yy
    @Mayank-jw9yy Месяц назад

    Amazing work please also share raw data of this amazing problem

  • @iswillia123
    @iswillia123 8 месяцев назад

    Thanks for the content you put out, Taufiq. One question: can't you put the coalesce/NVL in the base query? Then you wouldn't have to put 12 such statements after the pivot.

  • @rajudasari8482
    @rajudasari8482 2 года назад

    Good Approach, can we have one video on UN Pivot same scenario, and what about if the new month is added it won't be dynamic. Any approach?

  • @esteban3555
    @esteban3555 4 месяца назад

    in oracle, coalesce is definitely supported! 👍🏽

  • @winstonsmith8597
    @winstonsmith8597 11 месяцев назад

    MMM-YY, Great, some developer in the future will now need to Y3K proof the code. :)

  • @ManishkumarTiwari043
    @ManishkumarTiwari043 Год назад +1

    Great content tauphik sir, can you please create a separate video like this for unpivot...

    • @techTFQ
      @techTFQ  Год назад

      Sure bro will do it

  • @Tarunkumar-zw6sd
    @Tarunkumar-zw6sd Месяц назад

    can you make a video on transactions please. Appreciate your work ,Thank you.

  • @baburao25
    @baburao25 Год назад

    Thanks for the in detail explanation. Can you provide WEBAPI for the same

  • @kancharalaparameshwarreddy3837
    @kancharalaparameshwarreddy3837 2 года назад

    Good morning sir,next week plz provide on indexes And json

  • @raheemaslam6748
    @raheemaslam6748 Год назад +2

    🤩 you deserve millions subscribers bro

    • @techTFQ
      @techTFQ  Год назад

      Thank you so much :)

  • @ashokbhum06
    @ashokbhum06 9 месяцев назад

    Thank you buddy

    • @techTFQ
      @techTFQ  7 месяцев назад

      You're welcome ☺️

  • @chandrageetham
    @chandrageetham 2 года назад

    would you please deliver a class on clustered and nonclustered indices

  • @satheeshkumarak6708
    @satheeshkumarak6708 2 года назад +2

    Brilliant one Bro. Waiting for Unpivot and Regular Expressions 😅

    • @techTFQ
      @techTFQ  2 года назад

      Thank you and noted bro

  • @chocoloaga575
    @chocoloaga575 Год назад

    hi Sir, one Query. Can we use the pivot command without an aggregate function? Your Suggestions on this please.

  • @sharukhbilal5710
    @sharukhbilal5710 2 года назад +4

    Bro kindly make video on regular expressions from scratch till advanced level

    • @techTFQ
      @techTFQ  2 года назад +3

      Noted bro will consider it

  • @winattempts9835
    @winattempts9835 2 года назад

    Hi pls tell if recorded lecture available?
    and any price benifit compared to live?
    Please

  • @sarbarthamitra2081
    @sarbarthamitra2081 2 года назад

    Is there a way to do the reverse of pivoting (unpivot) in mysql? Using no special function

  • @sumibits
    @sumibits 2 года назад +1

    Thank you Taufiq. This is really helpful.
    I have one quick question. All period which you have used in example and query are kind of static one (Jan21, Feb21 …). How do we make it more dynamic? Meaning, what if we have updated sales data for year 23 or 24… changing period value in query may not be good idea in long run. Any thoughts on this ?

    • @alexanderbykovdev7364
      @alexanderbykovdev7364 2 года назад

      I haven't tried it yet, but can you try to use a query for the "for column value in ()" select and make some kind of distinct month-year in the same query?

    • @MiningForPies
      @MiningForPies 2 года назад

      In SQL server dynamic pivots are not supported natively. You would need to generate the SQL as a text string and run sp_execute sql on that. It’s a really big missing feature, stops me using pivots at all just not worth the hassle

  • @whoareyou9348
    @whoareyou9348 Год назад

    Hi tfq can you please upload the video about data validation and performance tuning

  • @saifsayyed07
    @saifsayyed07 Год назад

    Hii can you share the same problem with joins ? I don't exactly have the table but need to get data from different tables. Like 3 or 4 tables

  • @sunnygawande5283
    @sunnygawande5283 2 года назад +2

    One video on data cleaning in sql

    • @techTFQ
      @techTFQ  2 года назад +1

      Sure bro will do it

  • @Beant1980
    @Beant1980 2 года назад +17

    Thanks for the explanation. But instead of writing the names of Columns like JAN-21, FEB-21 inside PIVOT I use the function STUFF which does it dynamically. So, we can avoid writing the column names.

    • @muhammedsiraj6247
      @muhammedsiraj6247 2 года назад

      Can you please write the syntax ?

    • @Beant1980
      @Beant1980 2 года назад +1

      @@muhammedsiraj6247 try this.....
      1. SELECT @ColumnNames =STUFF(( SELECT DISTINCT ',' + QUOTENAME(PersonType)
      FROM databasename FOR XML PATH(''), TYPE
      ).value('.', 'NVARCHAR(MAX)'),1,1,'')
      2. PRINT @ColumnNames
      3. PIVOT (
      COUNT(PhoneNumberTypeID)
      FOR PersonType
      IN (' + @ColumnNames +
      ')
      )
      AS PIVOTTABLE'
      I have above points in a procedure, I can share the entire code with you. Thanks

    • @yassirnakkach5171
      @yassirnakkach5171 Год назад

      @@Beant1980 Hi Beant, can you please share the entire code with us?
      Many thanks!

    • @Beant1980
      @Beant1980 Год назад +1

      @@yassirnakkach5171 Hi, I have the code written in Microsoft SQL Server for AdventureWorks2016 database. I can email it you the text file?

    • @investshares8393
      @investshares8393 Год назад

      Hi Beant, can you pls also share the entire code with me pls. Thanks so much

  • @anburenganathan8369
    @anburenganathan8369 2 года назад

    Thanks thoufig.. Is it possible make column names are dynamic.. I felt you are hard coding?

  • @rkfacts4891
    @rkfacts4891 2 года назад

    Hi sir,kindly let me know Do you have any institution in chennai ?

  • @sayantankar9141
    @sayantankar9141 Год назад

    can you expalin that last part where you are finding the total respective of each column. Please explain the query you used in mysql

  • @merkleinc2648
    @merkleinc2648 Год назад

    It was asked in one of my interview. And I was like yaa allah iske aage bhi kuch hota hai kya

  • @vijayendrasdm
    @vijayendrasdm 2 года назад

    Hey Taufiq
    When are you planning to start fresh sql course ? Looking forward to enrol.
    Thanks.

  • @celebrationsthecelebschoic575
    @celebrationsthecelebschoic575 Год назад

    Can't we use distinct customer in select, add both date and customer in group by, and then use sum(amount)??

  • @hmudassi
    @hmudassi Год назад

    Good. how can we create columns dynamically?

  • @ManiKandan-kg5ky
    @ManiKandan-kg5ky 2 года назад +3

    Hi when will your next batch starts?

    • @techTFQ
      @techTFQ  2 года назад +2

      Probably in August

  • @jamalchotta3343
    @jamalchotta3343 8 месяцев назад

    Merci

    • @techTFQ
      @techTFQ  7 месяцев назад

      Je vous en prie :)

  • @maghy_kethychannel
    @maghy_kethychannel Год назад

    could you please make a video on date related functions

  • @ramanat1424
    @ramanat1424 2 года назад

    please tell me PL/SQL, POSTGRESQL both same or different?

  • @AmanKumar-bi4jl
    @AmanKumar-bi4jl Год назад

    Hey, I have two table one is student table with the field studentID, Name and other details and another is Attendance table with the field studentID and Date. I want to select record for each student for each day, fill record with the latter 'P' as present and 'A' as absent.
    How can I do??

  • @jamesopoku8049
    @jamesopoku8049 2 года назад +1

    Hi sir, good work done, please, may we get some videos on TRIGGER in postgresql....? Thanks

    • @techTFQ
      @techTFQ  2 года назад

      Thank you and sure will do

  • @baradhwajgudepu7110
    @baradhwajgudepu7110 11 месяцев назад

    Thank you taufiq, i struck in converting columns to rows can you help in doing that please

  • @jesthyrdevera9743
    @jesthyrdevera9743 Месяц назад

    Hello - For some reasons some of the data extracted using crosstab does not align in the columns they are expected to. For example there are 5 columns and one of the records has values for 1, 3 and 5 but when I used crosstab the values for columns 1,3 and 5 goes to columns 1,2 and 3. What should I do to align those data properly? thank you for those who will respond.

  • @brianligat2038
    @brianligat2038 Год назад

    The totals were a bit messy. Could you have added Total values along with the Customers and Months and created that with an initial WITH clause?

  • @sayantankar9141
    @sayantankar9141 Год назад

    what is hardcoding in mysql means can you please elaborate it or please make a seperate vedio on it.