views:

45

answers:

2

A user on SO recently gave me this Query to put into MYSQL, but I don't know what to do with the @ sign.

SELECT  user_id, GLength(LineString(utm, @mypoint))
FROM    users
WHERE   MBRWithin(utm, LineString(Point(X(@mypoint) - 20, Y(@mypoint - 20)), Point(X(@mypoint) + 20, Y(@mypoint + 20))
        AND GLength(LineString(utm, @mypoint)) <= 20

I'm doing everything in console. How would I assign @mypoint?

+1  A: 

check out variables here. They're pretty sweet.

Chuck Vose
+1  A: 

It's a variable. This is a legal SQL statement:

DECLARE @mypoint Int = 1;

You can put it before that query and it will insert 1 into every @mypoint. I am not sure what datatype your @mypoint should be, but that's the idea.

Scott Stafford