Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select
- o.inn,
- o.kpp,
- o.ogrn,
- o.fullname--, u.username, concat_ws(' ',u.lastname, u.firstname, u.middlename) as name
- ,o.registrationdate
- from organization As o
- Inner join organizationmember As om On o.id = om.organization_id
- Inner join nsi_okopf n On n.id = o.legalformid And n.id In (175,174,173)
- -- left join users u on om.userid = u.id and u.active = False
- Where 1=1
- And actual_id Is Null
- And registrationstatusid Is Null
- And external_customer = True
- --and o.id in (select organization_id from organizationmember where id in (select memberid from organizationmemberrole where roleid = 44) group by organization_id)
- Order by 1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement