 |
ปรึกษา sql server error : The multi-part identifier "Table_C" could not be bound. |
|
 |
|
|
 |
 |
|
SQL QUERY
DECLARE @c_code varchar(5)
SET @c_code= '89652'
SELECT *
FROM ( SELECT t_b.b_code,
t_c.c_name,
t_c.c_code,
t_b.b_date,
t_b.b_depart,
t_b.b_mode,
t_a.a_name,
t_a.a_dpo,
t_a.a_branch
FROM table_a as t_a
LEFT JOIN table_b as t_b
ON t_a.a_code = t_b.b_code
LEFT JOIN table_c as t_c
ON t_a.a_code = t_c.c_code
WHERE t_c.c_code = @c_code
GROUP BY t_b.b_code,
t_c.c_name,
t_c.c_code,
t_b.b_date,
t_b.b_depart,
t_b.b_mode,
t_a.a_name,
t_a.a_dpo,
t_a.a_branch
) As DataList
จาก SQL ข้างบน ถ้านำคำสั่งนี้ไป RUN บน SQL SERVER โดยตรง จะสามารถ execute ได้ปกติครับ ไม่พบ error ใดๆ
แต่พอให้ php ทำคำสั่งนี้จะขึ้น error ว่า " Fatal error: Uncaught exception 'Exception' with message '[Microsoft][SQL Server Native Client 10.0][SQL Server]The multi-part identifier "t_c.c_code" could not be bound.<br />' in ....... "
ไม่ทราบว่าต้องแก้ไขอย่างไรครับ และปัญหานี้เกิดจากอะไร
Tag : PHP, Ms SQL Server 2008
|
ประวัติการแก้ไข 2015-08-15 23:10:00
|
 |
 |
 |
 |
Date :
2015-08-15 23:08:21 |
By :
tatalas |
View :
1008 |
Reply :
5 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอดูคำสั่ง ใน PHP ด้วยครับ
|
 |
 |
 |
 |
Date :
2015-08-16 04:22:43 |
By :
NewbiePHP |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
555555 แค่นั้นก็แค่นั้น แค่ไหนก็เอามาดูทั้งไฟล์นั่้นแหล่ะครับ 55555
|
 |
 |
 |
 |
Date :
2015-08-16 20:43:40 |
By :
NewbiePHP |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ได้แล้วครับ
|
 |
 |
 |
 |
Date :
2015-08-19 08:31:14 |
By :
tatalas |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|