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 …
How do I calculate amount of time in each week between two dates – SQL Server
[EDITED TO SIMPLIFY] I have 500+ records. All of which have a reference number, a start date, an end date and a total machining time. Ref StartDate EndDate MachineTimeHours 123 24/01/…
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 to extract time in HH24:MM from varchar in Oracle
I have a column in the following varchar format. I would like to extract the time based on a condition e.g. < 7:00. Table1 Column: timer(varchar) 23:45 05:00 07:00 22:00 Expected output test ...
Select 3 and more duplicate rows in SQL Server
I’m learning the SQL Server and I got confused while selecting 3 and more duplicate rows in the SQL Server. I need to filter my data minimum 3 and more duplicate rows by using the SQL Server and I don’…
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 geom as geometry(GeometryZ,4326). I would like a query where properties return table_id, a
Select multiple columns with not all columns mentioned in Groupby – Postgres v12
I have a table which contain review_id,product_id,ratings,reviewer_id,review_comments. The table i have is as below. My need is quite simple but I have issues figuring it out. Need is to get …
MySQL trim or get specific set of string using substring locate
I have a column named cea_no from my table. But I want only specific string from it. I already tried several methods but it it wont work for me. Do you have any idea how could I achieve this? Here is my query The result I only want the R017722B part. Removing the “CEA: , the second set of strings