我遇到了这个 SQL 语句的问题:
$sql="SELECT b.FrameNumber, b.BikeCode, IF(b.ProductID = 0, p.FrameNumber)
AS FrameNumber
FROM BikeStock b LEFT JOIN Purchase p ON b.FrameNumber = p.FrameNumber
WHERE b.bikecode = '$bikecode'";
我希望 SQL 语句以这种方式工作:
Select FrameNumber & BikeCode from BikeStock
THEN IF ProductID(BikeStock) is equal to 0
then it will grab the framenumber from the purchase table where bikecode is equal to $bikecode
有任何想法吗?
提前致谢。