Skip to content

Tag: sql

SQL query for all grouped records in joined table

Let’s consider a toy example. There is a table employees and table tasks, where each task is assigned to one employee. One employee can have multiple tasks. I want to query employees filtering them by some columns in their tasks. I group the employees to display each one only once. The query would be so…

Error in sql syntax value ? but it’s showing the value?

the title isn’t very specific but I don’t know how to make it better. I’ve got this error in my sql telling me something is wrong but I don’t understand why it’s wrong, currently using mysql 8.0.24. If you wonder why it looks strange it’s because I use it in lua Sql: Error:…

How to find similar string value in Bigquery

I have two tables in my database, each table has column with names. How to compare these tables columns and how to find these names what has exact matches and these names, which are similar in table1 and table2? For example : Table 1 Table 2 : Result should come out with this: Table 1 –> Table 2 how …

Correct use of a LATERAL FROM

I am trying to use PostGIS to undertake a number of steps within an SQL statement to basically convert a raster to points, buffer, dissolve and then determine the overall boundary i.e. concave hull based on an attribute. The following is where I am at but get an error suggesting the use of a LATERAL FROM but …

Delete the row with the highest date difference

I have a table with values I would like to delete the row with the oldest student. I am able to get the ages with the following command but somehow I cant combine it with the DELETE stament I am using SQL lite Answer This would remove the first of the MAX result if there are some with the same

How to remove subtotals from groupby OLAP Cube?

output The filter shows field is not null. Why am I getting a Field NULL as part the EmployeeCount output when using cube? I figured it out. Cube includes subtotal and totals where the column is null Is there an easy way to remove the rollup values in the cube results Answer use group by grouping sets, it all…