Skip to content

Unknown column ‘r’ in field list

I’ve been working on a SQL query for a project, and I face an error message when I want to use it. Here is the query itself : MySQL answers me “Unknown column ‘r’ in field list”. But I dont really understand why I get an error here as I define r in my INNER JOIN. I’m kinda …

Select last value in each group

In database I have two table. I want to join two tables and get last row each SensorType Sensors table: Id CodeNumber PortNumber SensorType IsActive 13 Dht11 3 0 1 14 Dht11 3 2 1 17 Global 100 4 1 18 Dht11 3 1 1 19 Dht11 3 3 1 SensorsValue table (SensorId is foreign key Sensors table): Id SensorId

SQL procedure loop on a key from JSON object

I am trying to insert a JSON object into multiple tables CREATE TABLE images ( id serial primary key , image_url varchar(255), filename varchar(255) ); Procedure: CREATE OR REPLACE …

UNION tables with wildcard in BigQuery

I have over 40 tables I want to append in BigQuery using standard SQL. I have already formatted them to have the exact same schema. When I try to use the ‘*’ wildcard at the end of table name in my …

Percent Growth Calculation from Single Column

I am trying to calculate the percent growth of a single column (COUNT column) as shown below: DATE COUNT 2017-05-22 20 2017-05-29 42 2017-06-05 123 2017-06-12 21 2017-06-19 535 2017-06-26 …