I am trying to find the combined hourly average (travel time in this case) from a group of segments (code in the below) I get can get each segment individually but want to return sum all segments to …
How to insert data in multiple tables if tables have relationship OneToMany, and @Column(unique = true)
I have two tables MAKES and MODELS. Between them relationship @ManyToOne. Table MAKES: @Column(unique = true) private String make; Table MODELS: @Column(unique = true) private String model; When I …
adding values based on date range sql
Stuck on the problem below. Current data: table1 |emp_id | date | day_one |week_num | ————————————– | 100|2021-01-01| TRUE| 1| | 100|2021-01-02| …
How to get the last 7 weeks, 7 months date range from current date PHP?
How can I get the date range of last seven weeks /months from the current date, i have already done with last seven days fetch last seven days, weeks and month sales total grouped by 7 particular days, 7 particular weeks and 7 particular months ex: Last seven weeks Last seven Months The below query I have don…
Select IDs in pivot table including multiple pivot ID and excluding one pivot ID
How can I select the products that are in two categories and removing one category? Example: I wish to select only the products that are in the category one and category two, excluding the category …
SQL Query to Update the Start and End Date in a table from a different column where the dates do not match
I need a query which will Update the Start_Date and End_Date in this table. By Checking the Mapping column.When the value of date starts to change that should become the new start and end date. For example : The above two are same till the part 25-NOV-15-15-AUG-22. So our new Start_date for 1st record should …
Select Distinct (case insensitive) on Postgres
This has been asked here and a few other places before but seems like the suggested answers either don’t apply to postgres or don’t work in this situation. I’m looking to select distinct column names, eg: SELECT DISTINCT column_name FROM table_name WHERE … ORDER BY column_name however …
Set a databricks python variable with a %sql statement
The code in cell 1 works just fine. The problem I just don’t know the correct keywords to search to see how I can make the code in cells 2 & 3 work. Basically, in a %sql cell, can I select into a variable that can be later used in a python cell? I realize this may not even be
Ignore Null Bind Variables in SQL
I am trying to create a dynamic SQL Statement which can be used to filter based on several parameters. But one of the caveats is that not all parameters will be available, so could 4 variables or could be 0. This is my attempt at creating this query (small example with only one variable): This however throws …
How to write a single query to run some retrospective aggregation when time window is different for every row?
I am writing some SQL queries to create a dataset for customer churn predictions based on historical service data. Some of the services date back years ago. Small percentage of them churned at some time in the past while others ended up getting renewed. Some of the attributes are based on aggregation of the s…