Creating Custom SQL Queries

Very cool.

So how do I use a variable exactly? Is this correct?