declare @customer table
(
id int identity,
[name] varchar(100),
[type] varchar(10)
)
declare @documents table
(
id int identity,
[type] varchar(100),
customer_id int
)
insert into @customer values('Олег','ФОП')
insert into @customer values('Женя','Юр.лицо')
insert into @customer values('Таня','Физ.лицо')
insert into @customer values('Коля','Физ.лицо')
insert into @documents values('паспорт',1)
insert into @documents values('инн',1)
insert into @documents values('загран',1)
insert into @documents values('паспорт',2)
insert into @documents values('инн',2)
insert into @documents values('загран',2)
insert into @documents values('паспорт',3)
insert into @documents values('инн',3)
insert into @documents values('загран',3)
insert into @documents values('паспорт',4)
insert into @documents values('инн',4)
insert into @documents values('загран',4)
select *
from @customer as c
left join @documents as d on c.id = d.customer_id
select *
from @customer as c
left join @documents as d on c.id = d.customer_id
where d.type in case when c.type = 'Физ.лицо' then ('паспорт','инн','загран')
else ('паспорт','инн')
end
const human = {
name: 'Andrew',
getName1() {
return this.name
},
get getName2() {
return this.name
}
}
console.log(human.getName2)
console.log(human.getName1())
const humanName2 = human.getName2
console.log(humanName2)
const humanName1 = human.getName1()
console.log(humanName1)