mysql - SQL - find all the rows where the values are the same, or next biggest -


i have table in 1 column have lot of int -values x y , kinda loops. values go lowest highest, start again after awhile. values this:

tablerow: 2 5 10 15 .. 30 40 50 // , here begins again: 2 5 10 .. // , again: 2 5 10 // , sequence may change too: 3 6 10 

i search values same, or next biggest. i.e. if have search value of 6, search return rows value is: 10, 10, 10, , on. not fives, bigger ones. don't want all of bigger ones after value! next one. if have search value of 1.9 or less, search should return 2 -values. how form sql accomplish this?

ps: symfony "createquerybuilder" -example great, not necessary! :)

edit: (more info) table has other columns well, 10 others exact, including id-column well. no timestamps though.

you can find value looking using subquery. can matching rows:

select t.* table t value = (select min(value)                table t                value >= 6               ); 

Comments

Popular posts from this blog

IF statement in MySQL trigger -

c++ - What does MSC in "// appease MSC" comments mean? -

javascript - Blogger related post gadget image Resize s72-c [ Need Expert Help ] -