Combine Multiple Rows into One Cell Using SQL

Поділитися
Вставка
  • Опубліковано 1 січ 2025

КОМЕНТАРІ • 22

  • @raymondto1003
    @raymondto1003 2 місяці тому +1

    Thanks Anthony, your video is super helpful and very clear explain. Super like! Cheers!

  • @SP-fc9bx
    @SP-fc9bx 8 місяців тому +1

    You rock. SQL is so fun. I'm always learning something new. Thank you and thank everyone for sharing.

    • @AnthonySmoak
      @AnthonySmoak  8 місяців тому

      Thanks for the comment!

    • @AnthonySmoak
      @AnthonySmoak  8 місяців тому

      You rock for sharing this comment!

  • @LovelyJordy
    @LovelyJordy 2 роки тому +1

    Thank you Anthony. I’m learning SQL, Tableau, and Python right now and your videos are so helpful!❤

    • @AnthonySmoak
      @AnthonySmoak  2 роки тому

      Thank you for sharing this comment Jordan!

  • @balogunvincent201
    @balogunvincent201 8 місяців тому +1

    This was really a great help for me

  • @hasanmougharbel8030
    @hasanmougharbel8030 2 роки тому +1

    hello there, god bless your efforts..I have a simple enquiry as new sql learner.
    How are CTEs different from temporary tables?
    Thanks for taking care of this.

    • @AnthonySmoak
      @AnthonySmoak  2 роки тому +2

      Great question. There are many differences but the biggest difference is that the CTE has to be used in the current query scope (re-execute the CTE code everytime you want to include those results). The temp table will exist for the entire duration of your session and does not need to be re-executed everytime you want to reference its results.

  • @CKBowling1
    @CKBowling1 21 день тому

    How would you take them out of that one column and put them into Email1, Email2, Email3....

    • @AnthonySmoak
      @AnthonySmoak  21 день тому

      Use the STRING_SPLIT function. learn.microsoft.com/en-us/sql/t-sql/functions/string-split-transact-sql?view=sql-server-ver16

  • @lawrancegana6639
    @lawrancegana6639 Рік тому

    Is it work for oracle sql as well?

    • @AnthonySmoak
      @AnthonySmoak  Рік тому

      I believe Oracle has a string aggregate function. You may have to tweak the code a bit. Give it a try and let us know.

  • @MrSparkefrostie
    @MrSparkefrostie 2 роки тому

    Do you perhaps know how to reverse this, i have a row with all the emails linked to the project in one cell separated by a ; i need to have all those emails listed each in a row and the project they dealt with

    • @AnthonySmoak
      @AnthonySmoak  2 роки тому

      Try to experiment with the PARSENAME function in TSQL. The limitation may be that you need to know the project with the max number of emails, so you can repeat the PARSENAME function that many times. www.mssqltips.com/sqlservertip/6321/split-delimited-string-into-columns-in-sql-server-with-parsename/

    • @MrSparkefrostie
      @MrSparkefrostie 2 роки тому

      @@AnthonySmoak thank you, I managed to find string_split

    • @AnthonySmoak
      @AnthonySmoak  2 роки тому

      Ok great. I was thinking you needed each value as a new column instead of a row. String Split should work. 👍🏽

  • @aafreensultana1835
    @aafreensultana1835 2 роки тому

    Will this work if i have it in views and there are alot of inner joins ?

    • @AnthonySmoak
      @AnthonySmoak  2 роки тому

      The function should work against a view.

  • @uc7602
    @uc7602 Рік тому

    Great video. One suggestion... please consider either lowering or omitting the background music because I found it a bit distracting. Thank you, Anthony.