我在 mysql 中有一个表格,其中包含以下列:id
,view
,agree
。
我已经上传了 table 的图片:
我想在view
列中选择更高的8行。我的情况是 agree = 1
。
答案 0 :(得分:4)
Select * from table_name WHERE agree = 1 ORDER BY view desc LIMIT 8
答案 1 :(得分:1)
试试这个:
SELECT * from table
WHERE agree = 1
ORDER BY view DESC
LIMIT 8
答案 2 :(得分:1)
使用limit
和order by
Select * from mytable
where aggree=1
ORDER BY view DESC
LIMIT 8
答案 3 :(得分:0)
你可以这样做:
SELECT *
FROM yourTableName
WHERE agree = 1
ORDER BY view DESC
LIMIT 8
答案 4 :(得分:0)
您必须使用 ORDER BY 子句。
SELECT * FROM <TABLE_NAME> WHERE AGREE = 1 ORDER BY VIEW DESC LIMIT 8
答案 5 :(得分:0)
使用ORDER BY进行DESC
或ASC
排序。
并选择8行使用Limit Data Selections From a MySQL Database
Select * from table_name WHERE agree = 1 ORDER BY view desc LIMIT 8
答案 6 :(得分:0)
如果你想进入前8名&#39;查看&#39; MySql查询表中的值是:
export default class extends React.Component {
render() {
return (
<View style={{flex: 1}}>
<ItemsList
ItemDetail={ItemDetail}
items=items
/>
</View>
)
}
注意:将tablename替换为表的实际名称