Simple method to convert BAQ query to SQL server