下面是我的mysql查询我的查询有什么问题?
SELECT *
FROM practitioner AS p INNER JOIN postal_coad AS z
ON p.postal_code=z.PostalCode
WHERE (z.Latitude <= $latN AND z.Latitude >= $latS
AND z.Longitude <= $lonE AND z.Longitude >= $lonW)
AND (z.Latitude != $lat1 AND z.Longitude != $lon1)
AND z.city != '' ORDER BY PostalCode;
在从业者表中,我们有邮政编码和城市以及有关从业者的所有信息。
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`title` varchar(10) NOT NULL,
`fname` varchar(30) NOT NULL,
`mname` varchar(30) NOT NULL,
`lname` varchar(30) NOT NULL,
`credentials` varchar(30) NOT NULL,
`training` text NOT NULL,
`gender` enum('0','1') NOT NULL DEFAULT '1',
`hide_address` enum('0','1') NOT NULL DEFAULT '1',
`location_barrier` enum('0','1') NOT NULL DEFAULT '1',
`company` varchar(30) NOT NULL,
`street_address` varchar(70) NOT NULL,
`intersection` varchar(50) NOT NULL,
`city` varchar(30) NOT NULL,
`province` varchar(10) NOT NULL,
`postal_code` varchar(50) NOT NULL,
`phone` varchar(50) NOT NULL,
`add_phone` varchar(50) NOT NULL,
`sec_hide_address` enum('0','1') NOT NULL DEFAULT '1',
`sec_location_barrier` enum('0','1') NOT NULL DEFAULT '1',
`sec_company` varchar(30) NOT NULL,
`sec_street_address` varchar(60) NOT NULL,
`sec_intersection` varchar(60) NOT NULL,
`sec_city` varchar(30) NOT NULL,
`sec_province` varchar(10) NOT NULL,
`sec_postal_code` varchar(50) NOT NULL,
`sec_phone` varchar(50) NOT NULL,
`email` varchar(50) NOT NULL,
`website` varchar(50) NOT NULL,
`pract_comp_med` varchar(50) NOT NULL,
`pract_therapist` varchar(50) NOT NULL,
`pract_bodywork` varchar(50) NOT NULL,
`spec_comp_med` varchar(50) NOT NULL,
`spec_thearpy` varchar(50) NOT NULL,
`spec_bodywork` varchar(50) NOT NULL,
`personal_statement` text NOT NULL,
`OHIP` enum('0','1') NOT NULL DEFAULT '1',
`insurance` enum('0','1') NOT NULL DEFAULT '1',
`sliding_scale` enum('0','1') NOT NULL DEFAULT '1',
`languages` varchar(50) NOT NULL,
`photo` varchar(50) NOT NULL,
PRIMARY KEY (`id`)
这是从业者表的数据:
1, 1, 'nvbnb', 'bvnvbn', 'bnvb', 'bn', 'vbnvb', 'bnnbv', '1', '1', '1', 'bvnvbnvb', 'nvbnv', 'vbvbn', 'nvbnvbn', 'nbvnbv', '0', '0', '0', '1', '1', 'bnvbnvbn', 'nbvnvbnvb', 'bnvbnvb', 'vnvbnvbnvb', 'vbnvbnvb', '0', '0', 'bnvbnvb', 'vbnbvn', 'vbnvbnvb', 'nvbnvbnvb', 'vbnvb', 'nvbnvb', 'vbnvbnvb', 'vbnvbn', 'vbnvb', '1', '1', '1', 'bnbvnvbnvb', 'nbnbnb'
在邮政编码表中我们有
`POSTAL_CODE_ID` int(11) NOT NULL AUTO_INCREMENT,
`PostalCode` varchar(50) NOT NULL,
`City` varchar(100) NOT NULL,
`Province` varchar(100) NOT NULL,
`ProvinceCode` varchar(100) NOT NULL,
`CityType` varchar(100) NOT NULL,
`Latitude` varchar(100) NOT NULL,
`Longitude` varchar(100) NOT NULL,"
这是邮政编码表中的数据。
1 A0E 2Z0 Monkstown Newfoundland NL D
47.150300000000001 -55.299500000000002
我希望在输入的邮政编码和城市中或附近搜索practionaer信息。