My query uses left join to fetch multiple values from the table objects_values. I’m having trouble sorting the results the way I want; if ASC, then show the objects with the lowest attribute values first, and if DESC, show the objects with the highest attribute values first. I have actually managed to g…
Sum By Group in Access 2016 Query
I have a query that returns the following data: I am trying to adapt it to sum the total number of runs at each venue. I have come up with the query below but there are two issues: it is not summing by venue it is summing all runs; it takes a very long time to run. Can anyone see
Clone mysql database replacing some fields with predefined or default values [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 I want to copy MySQL database while replacing some vulnerable data(e/g. email, phone, name, …
List of Record type matching issue Oracle
I want to check if a workspace is not available in all_workspace table then create new workspace. My requirement is if p_workspace is not matching the list of value of v_workspace then it should create new one. It gives me error after creation. If I run that workspace individually then its working. but when I…
SQL Informix advanced query
Let me try to explain what I want to do with my data. Structure of my data is as follows: I have 3 columns: date, id, and stage. Stages can be different numbers, but I’m interested in showing specific transition of some id from stage -1 to stage 1. Please see the example below. I have an id that was
Using Surrogate Keys in Data Warehouse Pros and Cons
A surrogate key is a mechanism that exists in our books for years and I hate for bringing into discussion again. Everyone is talking about the benefits of using a surrogate key instead of a business key. Even Microsoft Analysis Services Tabular and Microsoft PowerBI Tabular Models are working with the surroga…
Select data from multiple existing tables dynamically
I have tables “T1” in the database that are broken down by month of the form (table_082020, table_092020, table_102020). Each contains several million records. There is a second table “T2” that stores a reference to the primary key of the first one and actually to the table itself only…
How can I count number of appearance of a value and make it into a new column when querying? [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 I have a table like this ProductID | SalesOrderNumber 1 | SO0001 2 | SO0002 3 | SO0001 4 | S…
SQL, group multiple rows into 2 rows and make one row
I have such a table Dates are subject to change, I want to group them in two rows. Dates range may be a maximum of 15 hours. My expected output is Answer Assuming every start date always has a matching end date, we can try: Here we are using pivoting logic along with the modulus of ROW_NUMBER to figure out
get one record at a time from joint table
I want to get a record from a joint table at a time. But I don’t hope the tables are joined as a whole. The actual tables are as follow. By specifying a cluster_id, I want to get one content name at a time where contents.status=2 and (contents name, cluster_id) pair is in content_cluster. The query in s…