BMS-HOSxP Community

HOSxP => การเขียน SQL Script => ข้อความที่เริ่มโดย: Bluebird ที่ สิงหาคม 31, 2012, 09:48:26 AM

หัวข้อ: SQL Variable ค่า ล่าสุด ไม่ให้แสดง จุดทศนิยม
เริ่มหัวข้อโดย: Bluebird ที่ สิงหาคม 31, 2012, 09:48:26 AM
SQL Variable ค่า ล่าสุด ไม่ให้แสดง จุดทศนิยม

select concat(bps,"/",bpd) as bp
from opdscreen
where hn="0000002" order by vstdate desc limit 1

ตัวอย่างผลที่ได้ 123.000/86.000

อยากรู้ว่าต้องเพิ่มเงื่อนไขตรงไหนเพื่อที่จะให้ค่าที่ได้ เป็น 123/86 ครับ
หัวข้อ: Re: SQL Variable ค่า ล่าสุด ไม่ให้แสดง จุดทศนิยม
เริ่มหัวข้อโดย: Farza ที่ สิงหาคม 31, 2012, 10:22:32 AM
ถ้า ใน Variable แบบนี้น่าจะได้
คลิกขวาที่ Variable  ----> Calculation
แล้วทำตามกรอบสีแดงดูนะครับ
หัวข้อ: Re: SQL Variable ค่า ล่าสุด ไม่ให้แสดง จุดทศนิยม
เริ่มหัวข้อโดย: golf_win ที่ สิงหาคม 31, 2012, 11:23:51 AM
Value := getsqlstringdata('select bps from opdscreen where vn="'+dbpipeline['vn']+'" and bps>0 order by vn desc limit 1 ')+' / '+getsqlstringdata('select bpd from opdscreen where vn="'+dbpipeline['vn']+'" and bps>0 order by vn desc limit 1 ')