You could take a look at this example and adapt that:
Typically it would depend on the syntax of the (SQL) database.you are using.