Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 concatenate

Author  Topic 

magic
Starting Member

2 Posts

Posted - 2014-10-21 : 20:30:50
I have following data:
DAYS OPENHR CLOSED
SATURDAY 08:00:00.0000000 17:00:00.0000000
FRIDAY 09:00:00.0000000 16:00:00.0000000
SUNDAY 10:00:00.0000000 16:00:00.0000000
MONDAY 08:00:00.0000000 17:00:00.0000000
WEDNESDAY 08:00:00.0000000 17:00:00.0000000
TUESDAY 09:00:00.0000000 17:00:00.0000000
Now, I want result like this:
mon-thu: 8-5
fri :9-4
sat:8-5
can somebody help me ?? i'm using db2 database.

Thanks,
mike

mike

magic
Starting Member

2 Posts

Posted - 2014-10-21 : 20:33:27
DAYS,OPENHR AND CLOSED are column name.Thanks!

mike
Go to Top of Page

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2014-10-22 : 11:50:19
Try a db2 forum

http://www.dbforums.com/forumdisplay.php?8-DB2
Go to Top of Page

mole999
Starting Member

49 Posts

Posted - 2014-10-25 : 07:07:45
not sure if its relevant

I would do

replace(replace(replace(replace(replace(replace(replace(DAYS
,'SATURDAY','sat'),'SUNDAY','sun'),'MONDAY','mon'),'TUESDAY','tues'),'WEDNESDAY','wed'),'THURSDAY','thur'),'FRIDAY','fri')
+ ' :' + left('OPEN HR',5) + '-' + left('CLOSED',5)

in SQL

maybe more or less complex

Mole
Go to Top of Page
   

- Advertisement -