Project

Profile

Help

HostedRedmine.com has moved to the Planio platform. All logins and passwords remained the same. All users will be able to login and use Redmine just as before. Read more...

insert select

Technical documentation
2015-02-06

ตัวอย่าง
INSERT INTO tms_maintain ( licenseplate,company_id,maintain_type, maintain_status,
remind_mile_number_expire, mile_number_expire,r_m_type)
SELECT v.licenseplate,3148,m.code,'0',
(coalesce(m.config_value,0) - coalesce(m.config_remind,0)), coalesce(m.config_value,0),'N'

FROM tms_master m
left join tms_mvehicle v on m.company_id = v.company_id

WHERE m.company_id = 3148 and m.table_name = 'maintain_type' --and m.config_value is not null and m.config_remind is not null
and (select count(*) from tms_maintain c where c.licenseplate = v.licenseplate and c.maintain_type=m.code::varchar and c.company_id = 3148 ) =0

order by v.licenseplate ;

Files