Skip to content

Category: Questions

Error for the query statement with CASE and Count

This is my original query statement…. SELECT airline company, country, count(country) “The no.of times the airline visits the country” FROM [table] GROUP BY airline company, country I think …

SQL Server Split Row based Subtraction value

I’m not sure whether my question is correct or not, but i want to generate output based below input then split the data based on karton quantity. Below is the output. Is it possible to make this …

Sorting by difference in column values

I have the following columns in my sql database table cities: zipcode | totalPetPopulation | numCats | numDogs My goal is to get all rows where numCats > numDogs but also I need to order them in …

Extract values from JSON with nesting

I have a problem with taking all values under the “id_ref_directory” keys. I have a temp table: CREATE LOCAL TEMP TABLE parsed_json( var_key text, var_value text NOT NULL) ON COMMIT DROP; …

How extract jsonb column in fields by key

I’m using postgresql and postgis plugin. I have stored data with this scheme: table_id is primary key, properties is a jsonb and geom as geometry(GeometryZ,4326); If I make this request: select table_id, properties, geom from nametable return all info with table_id as integer, properties as jsonb and ge…