如何在查询之间进行此操作,以便在同一列中查找不同的值


How can i make this between query to find different values in the same column?

因此,我将不同类型的测量值存储在名为值的列中

(select count(*) from `lara_measurements` inner join `lara_users_measurement` on `lara_measurements`.`id` = `lara_users_measurement`.`measurement_id` where `lara_users_measurement`.`user_id` = `lara_users`.`id` and `value` between 160 cm and 165 cm and `value` between 46 kg and 52 kg)

但由于这些值使用相同的列,因此使用AND不起作用,只有在两个查询之间只执行一个时才起作用

我到处找,但什么也没找到。

有人能给我一个提示吗?

您可以使用MysqlLIKE命令来查找使用通配符的任何内容:)

SELECT * FROM table WHERE name LIKE 'b%';

http://dev.mysql.com/doc/refman/5.0/en/pattern-matching.html

如果我正确理解了你的问题。尝试:
(select count(*) from `lara_measurements` inner join `lara_users_measurement` on `lara_measurements`.`id` = `lara_users_measurement`.`measurement_id` where `lara_users_measurement`.`user_id` = `lara_users`.`id` and (`value` between 160 cm and 165 cm or `value` between 46 kg and 52 kg))
抱歉,如果这是错误的想法,但很难准确说出你想要什么。