Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- table:example
- +--------------+--------------+-------------+
- | id_nr | code | subtype |
- +-------------------------------------------+
- | 1445 | 40D1343 | DRG |
- | 1445 | 23423asas | PROC |
- | 1234 | 234.34K | PROC |
- | 1233 | 2230S | DRG |
- | 1233 | 996k | DRG |
- | 1233 | 55239 | PROC |
- +--------------+--------------+-------------+
- table:example
- +--------------+-------------+-------------+-----------+
- | id_nr | subtype | ipc_code | asc_code |
- +------------------------------------------------------+
- | 1445 | DRG | | 40D1343 |
- | 1445 | PROC | 23423asas | |
- | 1234 | PROC | 234.34K | |
- | 1233 | DRG | | 2230S |
- | 1233 | DRG | | 996k |
- | 1233 | PROC | 55239 | |
- +--------------+-------------+-------------+-----------+
- select id_nr, subtype,
- (case when subtype = 'PROC' then code end) as ipc_code,
- (case when subtype = 'DRG' then code end) as asc_code
- from t;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement