I have another table which looked like this: I need to write two queries: Find users who did transactions twice on the same day, what product were they bought and how much were they spend on the 1st transaction. Find which users did transaction consecutively less than 10 minutes! I am very appreciating for yo…
Retrieve text between two periods in a value
I’ve been spinning around a bit on how to accomplish this in SQL DW. I need to extract the text between two periods in a returned value. So my value returned for Result is: I’m trying to extract the values between period 1 and 2, so the red portion above: The values will be a wide variety of lengths. I’ve…
Postgres recursive query – get path to root given a leaf node
I have a leaf node in a tree structure and I need a Postgres query to recursively traverse the parent nodes to get me the full path to my leaf node. My table looks like this – the problem being there is no specific root node (i.e the top-most managers end up reporting to each other) Given a user such
Which is the correct form to create one to many relationships between two tables on a Oracle database
I have a Oracle database in which I have two tables, RegistroPPL and Alias. One RegistroPPL can have multiple Aliases. Now, my question is, what is the right way to create this relationship, using a bridge table like this: or creating a direct relationship like this What is the best way to create one to many …
Why is my query returning far to many results?
I have a bunch of candidates, who have had one or more jobs, each with a company, using some skills. Bad ascii art follows: ————— ————— …
I have joined few tables and need total of the last column on the end of my query [closed]
I have wrote SQL query pulling 6 columns from 4 different tables, however I need on the last row total just for one column. It should look like this.
Datetime in Dynamic SQL
I’m trying to use datetime variables in a dynamic sql query. I’ve tried many queries but it never returns the right date. For example: declare @StartDate datetime = ‘2020-01-10′ SET @sql =’ …
Multiple foreign key constraints to distinct subsets of same relation
I have some xs. Every x either is or is not a y: y ∪ not_y = x y ∩ not_y = ∅ A y is a special x that can point to many other not_ys. A not_y cannot point to any x. Is there a way to create a …
I can’t save data from ComboBox vb6
My UserControl: All code from UserControl: Option Explicit Dim cnn As Connection Dim indice As Integer Public Property Get AddTypeID() As Integer AddTypeID = cmbAddExample(indice).ItemData(…
SELECT Only Cheapest Or Most Expensive Variant From Many
I have a table of product variants, grouped by a product key. I also have a category table which is joined off the ProductKey. So if I query for products in a category or many categories I will get a …