The reason I needed columns was for an Insert into another table
Isn't it simple to do a INSERT INTO with a SELECT statement? Something like this
Code:
INSERT INTO New_Table
SELECT FAMILY_ID
,CHAR(RTRIM(IFNULL(FIRST_NAME, ' ')) ||
CHAR(' ') ||
RTRIM(IFNULL(LAST_NAME, ' '))) AS FULLNAME
FROM Old_table
WHERE FAMILY_ID IN (123456, 654321)
;
Joined: 08 Oct 2004 Posts: 274 Topics: 52 Location: California
Posted: Tue Dec 18, 2018 5:06 pm Post subject:
kolusu,
I have xml to do the concatenating of data and flatting.
xml returns the data in a single column(as far as I know). I'm familiar with the link, I participated in it
The point of my post was to show how to take vertical data and be able to retrieve the data into individual columns. This query is only an example I'm sharing. _________________ Thanks,
NASCAR9
Last edited by NASCAR9 on Tue Jan 29, 2019 1:37 pm; edited 1 time in total
Joined: 26 Nov 2002 Posts: 12377 Topics: 75 Location: San Jose
Posted: Tue Dec 18, 2018 5:36 pm Post subject:
NASCAR9 wrote:
kolusu,
The point of my post was to show how to take horizonal data and be able to retrieve the data into individual columns. This query is only an example I'm sharing.
Nascar9,
I apologize for the oversight. Thanks for sharing the query. _________________ Kolusu
www.linkedin.com/in/kolusu
Joined: 08 Oct 2004 Posts: 274 Topics: 52 Location: California
Posted: Tue Dec 18, 2018 7:08 pm Post subject:
kolusu,
No apology necessary. Your help is second to none.
I posted the query because I have never seen/used the Function DECODE before.
It solves a problem I'm faced with periodical. I'm hoping it's able to help someone else. There are many ways to skin a cat in SQL. _________________ Thanks,
NASCAR9
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum