BMS-HOSxP Community

HOSxP => MySQL => ข้อความที่เริ่มโดย: munsat ที่ ธันวาคม 14, 2018, 17:11:50 PM

หัวข้อ: ขอตัวอย่างคำสั่ง Insert
เริ่มหัวข้อโดย: munsat ที่ ธันวาคม 14, 2018, 17:11:50 PM
ขอตัวอย่างคำสั่ง Insert ข้อมูลหลาย records ลงในตารางที่มี ID เรียงลำดับ เช่น ต้องการ Insert ข้อมูลลงในตาราง pp_special ที่มี field แรก คือ pp_special_id เรียงลำดับ :) :) :) :) :)
หัวข้อ: Re: ขอตัวอย่างคำสั่ง Insert
เริ่มหัวข้อโดย: ทานน้ำ ที่ ธันวาคม 26, 2018, 15:23:13 PM
 insert into pp_special (pp_special_id,vn,hn,pp_special_type_id)
(select get_serialnumber('pp_special_id') as pp_special_id,vn,hn,'1' from ovst where vstdate between '2018-12-26' and '2018-12-26')


ลองประยุกต์ใช้ดูนะคะ ไม่แน่ใจว่าอยากได้จากตารางไหนไปใส่เลยสมมุติเป็น ovst ค่ะ
หัวข้อ: Re: ขอตัวอย่างคำสั่ง Insert
เริ่มหัวข้อโดย: munsat ที่ ธันวาคม 30, 2018, 09:04:55 AM
ขอบคุณครับ