Here’s the use case for this: Get me a list of heats where element #18 is between 95 and 100 AND element #2 is between 0.0 and 0.5. This works just fine (not sure it’s the best SQL/approach, but it works). The question/potential problem is that the number of element/range conditions is variable. T…
Tag: sql
POST HTTP request that sends SQL data to a site [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 years ago. Improve this question Would there be a way to create a POST HTTP request that sends SQL data to a site and then a …
Why can’t we update a view which has DISTINCT Clause in its definition? [closed]
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 1 year ago. Improve this question I am not getting the logic behind the fact that a view can’t be updat…
Converting query from SQL to pyspark
I am trying to convert the following SQL query into pyspark: The code I have in PySpark right now is this: However, this is simply returning the number of rows in the “data” dataframe, and I know this isn’t correct. I am very new at PySpark, can anyone help me solve this? Answer You need to …
Is there a way to loop through selected columns in plsql
I have a table TestTable with columns of col_test1, col_test2, col_test3 … and I want to create a loop that accesses each of these columns individually and find the max value and place it in the variable made in the declare block and simply dbms.out.put it. The output I get is just the string ‘col…
Break periods at the end of the month
SQL Server 2017 CREATE TABLE [TABLE_1] ( PLAN_NR decimal(28,6) NULL, START_DATE datetime NULL, ); INSERT INTO TABLE_1 (PLAN_NR, START_DATE) VALUES (1,’2020-05-01′), (2,’2020-08-01′); …
Oracle SQL: select from a set of orders only those that contain certain types
I want to select from a set of orders only those that are marked with certain types. Example: Let’s assume I have a table X. In my case I want to select only those orders that contain both A and B: My work so far: However, I don’t like this solution. Is there a better approach? Answer Use an analy…
SQL query to get Most Frequently purchased and Most Recently purchased quantity for a customer-product pair
I have a table Customer_Order_Data with these columns: customer_id order_id product_id quantity order_date For all the dataset available I want to find out the most frequently purchased quantity and most recently purchased quantity for a customer-product pair. Let’s say I have the following data –…
output need to achieve by one query
I have table which consist data like below. I need output in pivot : I can achieve by separate queries easily but is it possible to get it done by one query? Answer You can use conditional aggregation such as in order to return results pivoted.
What did I miss in this MariaDB query? I’m getting now a SQL syntax error
Every time I get Error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘by, user, reason, active) VALUES (5, 663403380223377400, 793061601288388600, 274’. Did I miss something in the query? MariaDB version: 10…