I am trying to create a script that would compare and get the higher value from current row versus the value resulted from the same comparison of the previous row. For example: Row 2 Column ‘Given’ > Row 5 Column ‘Result’. Therefore, Row 2 Column ‘Result’ gets the same v…
SQL query to find the concurrent sessions based on start and end time
Below is a sample dataset showing TV sessions of each TV set of each household. Household “111” switch on their TV “1” at 500 and switch it off at 570. However, this has been captured in the data as 2 separate rows. You will have to write a query to convert this into a single row. Similar modification needs t…
How can I refer to 2 differents dataset into a gsheet query formula?
I’m trying to get a formula to match 2 different data set in google sheets. I did the following but I keep getting “parse error” With D10 is the cell that I’ll look up the match for. Let me know if you have any tips and thanks! Answer The syntax for QUERY is QUERY(data, query, [headers…
Oracle SQL Join an ID on a field with a list of IDs some with ranges
First of all, its not my database and I cannot change it:) This is an oracle database I have a table with 2 ID fields code and subcode: Table1 ID Code Subcode 1 300 010 2 400 050 3 300 060 I …
how can I select a rows that repets two atributtes
I have a table with Destino and Tronco, Fecha and I need to group the Destino and Tronco that repeats SELECT Destino ,Tronco ,Count(*) AS Countrows FROM Hist_LDS WHERE Fecha = ‘2020-10-28’ …
Combine two table with different column name using Union all
I have two tables T1 and T2 with column name proj in T1 and projectID in T2. I have to combine these two tables using Union all. As both column has similar kind of information. How it can done so that it is visible under one column name Answer if the datatype are same ,the column names for a UNION
In Oracle SQL is there a way to join on a value twice?
Lets say I have two tables, with the following columns: cars fuel_types In this case fuel_id and secondary fuel_id both refer to the fuel_types table. Is it possible to include both labels in an inner join? I want to join on the fuel_id but I want to be able to have the fuel label twice as a new column. So
Postgresql how to select columns where it matches conditions?
I have a table like this: I want to select rows where most recent date with corresponding columns, This is what I want to achieve: I tried to use aggregate but I need inventory_id and customer_id appear at the same time. Is there any method that could do this? Answer Use distinct on: distinct on is a Postgres…
SQL database design: many to many relationship between ‘accounts’ and ‘transactions’ tables such that a transaction can have ‘from’ and ‘to’
I’m trying to create a many-to-many relationship between two tables: ‘accounts’ and ‘transactions’, but with a catch. Every transaction must be related to two accounts, but each of those accounts must be specified as either the sender or receiver. Likewise, each account should re…
Create internal table with column names and values from another tables column data in ABAP [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 which have fields like fieldname and fieldvalue. I am trying to turn this tab…