Hi John
For a Custom Query with a SQL Connection, it could look like this

SELECT * (All Columns) from the Table, you can change this to specific fields by naming the fields such as SELECT [Column1 name], [Column2 name]
FROM TableName in the DBO selected
WHERE is what you are Querying on. I created the Parameter name on the left to use in the statement, Parameter value is the token from your workflow that contains the data for the query. You need to proceed the Variable name with an @
Order By ColumnNames use asc or desc to choose whether the column is ascending or descending, sort by additional columns by separating the additional Order columns by a comma (,)
Highly recommend you have a look at https://www.w3schools.com/sql/default.asp to learn more about SQL statements. They also provide good content for CSS, HTML, etc
As an FYI, a Custom Query in Workflow looks slightly different based on whether you use a SQL vs an ODBC connection. I recommend a SQL connection
For a ODBC connection you replace the Parameter Names with a "?" and have to have them in the order in which those variables appear in your statement
Hope this helps