 |
ช่วยหน่อยนะค่ะ พี่ถ้าเราใช้mysqlแล้วใช้คำสั่ง EXCEPT มานใช้กานได้ไหมอ่า |
|
 |
|
|
 |
 |
|
พี่ถ้าเราใช้mysqlแล้วใช้คำสั่ง EXCEPT มานใช้กานได้ไหมอ่า
พี่ว่ามานเกี่ยวไหมอ่าหนูทามแล้วมาน error อะ
คำสั่งนี้
Code (PHP)
$result = mysql_query(" select Name_Sc,Name_Tc,Requirement.ID_Sc,Requirement.ID_Tc
from School,Teacher,Requirement
where School.ID_Sc = Requirement.ID_Sc and Teacher.ID_Tc = Requirement.ID_Tc and Requirement.Re_Status = 'connect' EXCEPT
select Name_Sc,Name_Tc,Requirement.ID_Sc,Requirement.ID_Tc
from School,Teacher,Requirement,Promise
where School.ID_Sc = Requirement.ID_Sc and Teacher.ID_Tc = Requirement.ID_Tc and Requirement.Re_Status = 'connect' and Requirement.ID_Sc = Promise.ID_Sc and Requirement.ID_Tc = Promise.ID_Tc")or die(mysql_error());
errorยังงี้

จาแก้ไงดีค่ะ
Tag : - - - -
|
|
 |
 |
 |
 |
Date :
2009-12-25 16:38:49 |
By :
LuckyStar |
View :
1833 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
จะหาข้อมูลของ A ที่ไม่มีใน B ใช่ป่ะลองเปลี่ยนจาก Except เป็น not in ดู
Select id,name,callroom from tb_a where id not in (select id from tb_a where classroom_tc is null)
|
 |
 |
 |
 |
Date :
2009-12-28 13:57:13 |
By :
salapao_codeman |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
พี่ว่าแบบนี้ถูกไหมใช้ not inอะ
Code (PHP)
$result = mysql_query(" select Name_Sc,Name_Tc,Requirement.ID_Sc,Requirement.ID_Tc
from School,Teacher,Requirement
where School.ID_Sc = Requirement.ID_Sc and Teacher.ID_Tc = Requirement.ID_Tc and Requirement.Re_Status = 'connect' not in
(select Name_Sc,Name_Tc,Requirement.ID_Sc,Requirement.ID_Tc
from School,Teacher,Requirement,Promise
where School.ID_Sc = Requirement.ID_Sc and Teacher.ID_Tc = Requirement.ID_Tc and Requirement.Re_Status = 'connect' and Requirement.ID_Sc = Promise.ID_Sc and Requirement.ID_Tc = Promise.ID_Tc)")or die(mysql_error());
แต่พอเปลี่ยนแล้วมานerrorว่า
Operand should contain 1 column(s)
|
 |
 |
 |
 |
Date :
2009-12-28 15:57:55 |
By :
LuckyStar |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|