Is it the same query as in this question? Annotation Query Fails
If so then maybe you need to read about what time series are first. Grafana is built primarily for time series data and not relational data. It is possible to write time series queries with SQL but it is a little bit harder than for a specialized Time Series Database (TSDB). Your select statement should return (at least) three columns: a datetime column, a metric name column and a value column.
The docs for the data source are here: