Greetings to senior colleagues. I got caught up in this thing. It is necessary to substitute the corresponding values in the CASE when the construction depending on the state of the load_date field. The problem is that the second was assigned a value to the mean_v field based on the calculation of the average mean_v obtained for the subsample. how
Tag: subquery
SQL Combining MAX and SUM
So I have one SQL table that contains the below columns: There are ~2800 unique License numbers and will have numerous FundsIn each day. I am trying to find the last date there was activity (ActivityDate) and the sum of all of the FundsIn on that MAX ActivityDate. Below is a query I’ve been trying to modify to get it
Trying to make a new table by pulling data from two tables and keep getting ‘Error: Every derived table must have its own alias’ on this query
I have an ‘Orders’ table and a ‘Records’ table. Orders table has the following columns: Records table has the following columns: I’m trying to pull and compile the following list of data but I keep getting an error message: Here’s my query: What am I doing wrong? Answer The subquery in the join needs an alias. It also needs to
SQL statement to select all dead people
I have tables: City: zip, name,… People: id, city_zip(refers to city.zip), born_time, dead_time I need to select data about cities where ALL people from that city are dead: born_time NOT NULL AND …
subquery must return only one column during insert data for returning
is that any way for returning join column during INSERT INTO ? here is my query the last sub query is not work because i want return the villages table with two columns is that any way to pass that 2 columns ?? Answer You can use a CTE with returning . . . and then a query: However, the
SQL – Update table column values using expression based on two tables
Using a Sqlite database, I have a users table and a ranks table with the following columns: users table: id | rankid | xp ranks table id | name | xpLowerLevel My goal is update the rankId field for all user rows based on the xpLowerLevel field from the ranks table. My Sql expression as follows: Which gives me the
How to filter record in a table with different condition
How to find the record in a table which as only ‘Return’ as Reason? I have table which has many records As per the data in the table, it returns only records with policy number 5555, because only that policy number has only ‘Return’; all other policy numbers have both ‘Return’ and ‘Success’ which I don’t need. Kindly help me.
SQL Column Contains ID of Another Row
Suppose I have a SQL database my_table of the following form where one column contains the id of another row. How can I select both the name column of the given row and the name of the underlying id …
Delete with inner join and trigger throw error: Can’t update table ‘table_b’ in stored function/trigger
Why the following error (Can’t update table ‘table_b’ in stored function/trigger because it is already used by statement which invoked this stored function/trigger) appears after i try to delete with inner join? Can i solve it? Answer I don’t see the point for a trigger here. The functionality you want can be achieved by just adding the on delete cascade
SQL – WHERE NOT EXISTS [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 1 year ago. Improve this question I have a table with employees ID NAME SALARY and I am getting the employee with the most salary with this SQL statement: as I