在显示 MySQL Workbench 上所有列的变量中提取值 >100 的行
Extract Rows with Values >100 in a Variable Showing All Columns on MySQL Workbench
我有一个大型数据集,其中包含如下数据:
Cancer_Type Age Crude_Rate
Melanoma 20-24 30.5
Lung 70-74 212
Myeloma 55-59 101.8
Leukemia 35-39 77.9
我想提取行数 Crude_Rates 大于 100 的所有列,即对于上面的数据片段,将提取的是:
Cancer_Type Age Crude_Rate
Lung 70-74 212
Myeloma 55-59 101.8
我正在 MySQL Workbench 上尝试以下代码:
SELECT Cancer_Type, Gender, Crude_Rate
FROM cancer.agescancer
WHERE Crude_Rate=(SELECT Crude_Rate WHERE Crude_Rate>100 FROM cancer.agescancer)
我收到以下错误:
Error Code: 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 cancer.agescancer)' at line 3
并且我代码中的 100 带有红色下划线。我不确定我做错了什么。
在此先感谢您的帮助
只需将您的查询更改为
SELECT Cancer_Type, Gender, Crude_Rate
FROM cancer.agescancer
WHERE Crude_Rate >100
我有一个大型数据集,其中包含如下数据:
Cancer_Type Age Crude_Rate
Melanoma 20-24 30.5
Lung 70-74 212
Myeloma 55-59 101.8
Leukemia 35-39 77.9
我想提取行数 Crude_Rates 大于 100 的所有列,即对于上面的数据片段,将提取的是:
Cancer_Type Age Crude_Rate
Lung 70-74 212
Myeloma 55-59 101.8
我正在 MySQL Workbench 上尝试以下代码:
SELECT Cancer_Type, Gender, Crude_Rate
FROM cancer.agescancer
WHERE Crude_Rate=(SELECT Crude_Rate WHERE Crude_Rate>100 FROM cancer.agescancer)
我收到以下错误:
Error Code: 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 cancer.agescancer)' at line 3
并且我代码中的 100 带有红色下划线。我不确定我做错了什么。
在此先感谢您的帮助
只需将您的查询更改为
SELECT Cancer_Type, Gender, Crude_Rate
FROM cancer.agescancer
WHERE Crude_Rate >100