你好,正如我昨天讨论的从多个表中检索数据到
多个查询,但我得到了很多关于将表连接到一个查询中的好建议。
实际上在这里我将多个表加入到一个查询中,但我想检索数据
仅从两个表中,T1 是属性,T2 是相关属性的图像。
我做到了,但它给出了一个我找不到的错误。
Error Massage : #1064 - You have an error in your SQL syntax;
check the manual that
corresponds to your MySQL server version for the right syntax to use near 'FROM
properties, provinces, districts, pds, propertyimages WHERE Provinces.'
at line 22
Here is the Query:
"SELECT
properties.PropertyID,
properties.PropertyName,
properties.PropertyType,
properties.PropertyDealType,
properties.PropertyRegion,
properties.PrepostedPrice,
properties.PricePerArea,
properties.DealStatus,
properties.MoreinfoDealGeneralInformation,
properties.MoreInfoPropertyGeneralInformation,
properties.CurrencyType,
propertyimages.PropertyID,
propertyimages.ImageName,
propertyimages.ImagePath,
Provinces.ProvinceName,
districts.DistrictName,
pds.PDName,
FROM properties, provinces, districts, pds, propertyimages
WHERE Provinces.ProvinceID=Properties.ProvinceID
AND districts.DistrictID=Properties.DistrictID
AND pds.PDID=properties.PDID
AND properties.PropertyID=propertyimages.PropertyID
AND ProvinceName= 'Kabul'
AND DistrictName='KabulCity'
AND PropertyDealType='For Rent'
ORDER BY properties.PropertyID";