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.
Author |
Topic |
knichols
Starting Member
12 Posts |
Posted - 2012-03-12 : 08:18:01
|
Hello , I got some time to speak briefly with my DBA and that is what we decided was the best route, Here is some new code for the same issue: select concat(to_char(effdt, 'YYYYMMDD'),to_char(arrival_time,'HHMISS')) dte, decode(worksite, '76xx', 1, 0) flg_home, decode(worksite, '76xx', 0, 1) flg_over, worksite, contract_no, transit, deploy_status, deploy_purpose from sysadm.ps_dy_ee_worksite where emplid = '90xxxx' and contract_no = 'LOxxxx' order by dte How do I increment the flag and get the dates in a different location by using that flag? I also want to include a flag for when the code sees anything like AGxxx where xxx can be a number so I guess it would be a wildcard like %AG% or maybe just AG%. Here is some additional info and output: ----- if deploy_status = 'ctry' and flg_home = '1' then----- add flg_over using dte to get totalt time overseas--- when deploy - ctry this means they are overseaswhen deploy status = PMO they are here at the home office dte flg_home flg_over worksite contract transit deploy status20091201111930 1 0 76xx Lxxx D 20100216012138 0 1 2Kxx Lxxxx A CTRY PERMANENT20100412011435 0 1 DIxx Lxxxx D CTRY SITE VISIT20100421120000 0 1 AGxx Lxxxx D CTRY TEMPORARY20100422103718 0 1 AGxx Lxxxx D CTRY SUPPORT20100426110503 0 1 AGxx Lxxxx D CTRY SUPPORT20100428075337 0 1 AGxx Lxxxx D CTRY SUPPORT20100429114013 0 1 AGxx Lxxxx D CTRY SUPPORT20100501060106 0 1 AGxx Lxxxx D CTRY SUPPORT20100507021617 0 1 DIDC Kxx x Lxxxx D CTRY SUPPORT20100513021658 1 0 76xx Lxxxx D PMO PERMANENT20100615054043 0 1 AGxx Lxxxx D CTRY INRTE20100616051842 0 1 AGxx Lxxxxx D CTRY SITE VISIT20100619023101 0 1 OFF xxxx x Lxxxxx D CTRY SUPPORT20100620103658 0 1 DIxx Kx 4 Lxxxxx D CTRY SUPPORT20100623120000 1 0 76xx Lxxxx A PMO 20101001092435 1 0 76xx Lxxxxx A PMO PERMANENT20101004085359 1 0 76xx Lxxxxx A CTRY PERMANENT20101004125327 1 0 76xx Lxxxxx A PMO PERMANENT I hope this sample data helps. Of course I had to sanititze the data but it should help to see the flow of what I am trying to do. Thanks, Kurt |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2012-03-12 : 08:41:22
|
are you using Oracle or SQL Server 2008 ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
|
|
|
|