mysql修改查询以显示我的表的所有记录

mysql修改查询以显示我的表的所有记录,mysql,Mysql,我是mysql的初学者,我有一个疑问: SELECT ((ACOS(SIN('45' * PI() / 180) * SIN(latitude * PI() / 180) + COS('45' * PI() / 180) * COS(latitude * PI() / 180) * COS(('-75' - longitude) * PI() / 180)) * 180 / PI()) * 60 * 1.1515) AS `distance` FROM `account` HAVING `dis

我是mysql的初学者,我有一个疑问:

SELECT ((ACOS(SIN('45' * PI() / 180) * SIN(latitude * PI() / 180) + COS('45' * PI() / 180) * COS(latitude * PI() / 180) * COS(('-75' - longitude) * PI() / 180)) * 180 / PI()) * 60 * 1.1515) AS `distance` FROM `account` HAVING `distance`<='100' ORDER BY `distance` ASC
这很好,但它只给了我距离作为结果。。。我想让我表中的所有字段。。。我试过了


从帐户中选择*,其中。。。作为距离。但它不起作用。。。谁能帮我修改这个查询。。。感谢使用MySQL,如果您想在SELECT语句中使用*和其他字段/表达式,换句话说,除了SELECT*之外,您还需要使用表别名。因此,您的代码需要如下所示:

SELECT a.*,
       ((ACOS(SIN('45' * PI() / 180) * SIN(latitude * PI() / 180) + COS('45' * PI() / 180) * COS(latitude * PI() / 180) * COS(('-75' - longitude) * PI() / 180)) * 180 / PI()) * 60 * 1.1515) AS `distance`

FROM `account` AS a

HAVING `distance`<='100' 

ORDER BY `distance` ASC;