mysql - How to select only last rows that satisfies conditions? -
i'm trying select rows x=5, x changes constantly. have such table:
id x ---- --- 1 5 2 6 3 4 4 5 5 5
so want perform query "select * table x=5 , _???_;"
returns rows 4 & 5 not row 1.
in other words, want rows x had value recently. hope made myself clear. thanks!
edit: number of entries after x got lastly value change. mean table this:
id x ---- --- 1 5 2 6 3 4 4 5 5 1 6 5 7 5 ... 5 100 5 101 5
in case should homecoming rows [6-101].
following wil recent row
select * table x=5 order id desc limit 0,1
mysql select
No comments:
Post a Comment