我正在尝试编写一个MySQL查询来比较两个表中的列,并为其他条件添加WHERE。
我希望我尝试做的例子会有所帮助。
SELECT `practice-name`, `practice-address-4`, `practice-address-5`, `practice-bnf-name`
FROM `practice-information`
JOIN `practice-prescribing`
WHERE `practice-information.practice-number` = `practice-prescribing.practice-number` AND
`practice-name` LIKE "%%" OR `practice-address-4` LIKE "%%" OR
`practice-address-5` LIKE "%%" OR `practice-bnf-name` LIKE "%%"
LIMIT 0, 5
答案 0 :(得分:0)
SELECT
`practice-name`,
`practice-address-4`,
`practice-address-5`,
`practice-bnf-name`
FROM `practice-information`
JOIN `practice-prescribing` ON `practice-information`.`practice-number` = `practice-prescribing`.`practice-number`
WHERE
`practice-name` LIKE "%PUT STUFF HERE%" OR
`practice-address-4` LIKE "%PUT STUFF HERE%" OR
`practice-address-5` LIKE "%PUT STUFF HERE%" OR
`practice-bnf-name` LIKE "%PUT STUFF HERE%"
LIMIT 0, 5