|
![](/images/resource/spacer.gif) |
|
จะให้แสดงค่าตัวอักษรแทนค่าในฐานข้อมูล mysql ขอคำแนะนำหน่อยครับ |
|
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
select b.cid,b.hn,
a.lab_order_number,a.order_date,
lab_items_name_ref,
lab_order_result
from lab_head a
left outer join vn_stat b on a.vn=b.vn
left outer join lab_order c on a.lab_order_number=c.lab_order_number
where b.vstdate between"2020-01-01"and"2020-10-30"
and c.lab_items_code in(3205,3049,3559)
จะสอบถามว่าถ้าผมจะกำหนดค่าในการแสดงออกมาให้ในตารางให้ c.lab_items_code in(3205,3049,3559) ตรงส่วนนี้ค่า 3205 เป็น H แล้วก็ 3559 เป็น V ในตารางจะสามารถทำได้ไหมครับ แล้วต้องใช้การกำหนดเงื่อนไขไหมครับขอบคุณครับ
Tag : PHP, MySQL, MySQL
![](/images/adv.jpg?v=1001)
|
|
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2020-10-21 11:34:56 |
By :
punza2020 |
View :
522 |
Reply :
1 |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
แก้ปัญหาใน App Level ง่ายกว่า
Code (PHP)
$items_code = "";
while (...) {
switch ($row['lab_items_code']) {
case "3205":
$items_code = "H";
break;
case "3559":
$items_code = "V";
break;
default:
$items_code = "";
}
}
ไม่งั้นคงต้องขอดู Sample Data ด้วย DDL/DML Statements
|
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2020-10-21 15:23:39 |
By :
PhrayaDev |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
|
|
|
![](/images/digitalocean-banner.jpg)
|
Load balance : Server 03
|