mysql - How to find matrix element with sql query? -
i have array , table referenced elements in array. array
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
and have area start point s=9,x=2,y=2,row count r=6
have boxes 9,10,11,15,16,17,21,22,23
trying write sql check if 16 number in area.i created logic if ((s<16<s+x) || (s+6<16<s+x+6) || (s+12<16<s+x+12) )
should write in 1 sql query? using mysql.
this doesn't have sql, don't think, following condition want. since example has same value of x , y, , "row count" sounds more "number of rows" "number of items in row," may have gotten rows , columns backwards want.
set @s=9, @x=2, @y=5, @r=6, @testval=16; (@testval-1)/@r between (@s-1)/@r , (@s-1)/@r - @y - 1 , (@testval-1)%@r between (@s-1)%@r , (@s-1)%@r - @x - 1
Comments
Post a Comment