I have a grafana dashboard that charts a bunch of data on 2 query’s, this is one below: And this is the other query: Would anyone know how I could modify this into one SQL expression for a totalization? Instead of 50 different lines on my chart, just one line of all variables added together. The data is…
Change + ordered to + leading
I’m trying try to find the most selective criteria to start joining in SQL. I tried this: But this + ordered is deprecated. How I can implement this query using + leading? Answer Use the leading hint and put the table aliases between parentheses in the order you want the database to join them, for examp…
Symfony 5 queryBuilder count data
in one of my queries I am joining three tables to allow me to filter by taking into account these three tables. The problem is when I do a counter of the data from the main table (CV table), like I …
Clickhouse; Issues listing ip addresses where the column has multiple ip addresses
I am trying to get a list of all of our users’ IPv4 addresses in a Clickhouse Table. Since some of our users have multiple IPv4 addresses separated by a comma, I created this query: but it gives me this error: Nested type Array(String) cannot be inside Nullable type. is it possible to only select a port…
Determine if an event happened every hour for 24 straight hours
Edit – I am still digesting the great responses and learning how they work, awesome knowledge! Using SQL Server 2016, I am trying to figure out if any users have done something at least once every hour, for 24 consecutive hours. I have a table similar to this, in the example below, the only user who qua…
How to split and convert to pascal case oracle column names?
I want to selec column names and convert to pascal case. My column names are like this: IMG_SAR_NAME INT_AKT_DESC I want to split “_” names and convert to: ImgSarName IntAktDesc I can get column names with sql But can not convert to pascalcase. Answer I don’t know if always the underscore is…
How to use ‘between’ in CASE statement?
I need to select Shift from my production table such that if the time time is between 05:00 PM to 06:30 AM it is Shift B else its Shift A. The SQL that I have written is quite simple but does not gives me the expected results. The SQL is The Result I get is Shift_FK_ID 1 1 1 Where
is there a method to conect to postgresql (dbeaver ) from pyspark?
hello i installed pyspark now and i have a database postgres in local in DBeaver : how can i connect to postgres from pyspark please i tried this but i have an error Answer You need to add the jars you want to use when creating the sparkSession. See this : https://spark.apache.org/docs/2.4.7/submitting-applic…
SQL – How to calculate product discount and get products where discount is greater than 25?
I want to calculate discount in SQL query and want to get products having discount greater than 25. I am trying with following query. Please correct me what i am doing wrong. Thank you I am getting following error. #1054 – Unknown column ‘p_discont’ in ‘where clause’ Answer use i…
Add on to an existing value in a field
In MySQL I would do something along the lines of I tried the following but after a bunch of searching I wasn’t able to find how to do the same in postgresql so my question is how would I go about adding a number to the previous value of a field (BIGINT) Answer You have to catch the value from