Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. select * from (
  2. select distinct lgmd.l_id
  3. , lgmd.lg_id
  4. , case
  5. when lgh.lg_id_in = 100344 then 'aframe'
  6. when lgh.lg_id_in in (100410) and l.geocode not like 'A-%' then 'cuby'
  7. when lgh.lg_id_in in (100007, 100006, 100801, 100802, 100803, 100804) then 'flowrack_orion'
  8. end as "area"
  9. from location_group_member_def lgmd
  10. JOIN location_group_hierarchy lgh ON lgmd.lg_id_in = lgh.lg_id
  11. AND lgh.lg_id_in in ( 100344 /* aframe */
  12. , 100410 /* cuby*/
  13. , 100007, 100006, 100801, 100802, 100803, 100804 /* flowrack orion*/
  14. )
  15. LEFT JOIN location l ON l.l_id = lgmd.l_id
  16. WHERE area is not null) where l_id = (Select l_id from location where geocode like 'A-21-01D');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement