I have 2 IF. If No 1, is work for me. Because i wont if data is present and get house keeping == null. for action to update condition,status,and housekeeping. IF no 2, no work for me. I wont if getData is present and get housekeeping is availabe / not null. For action only to update condition Only check ̵…
Tag: sql
Self Joining between 2 same tables
For instance I have a table called employees where it consists of “Employee ID”, “First Name”, “Last Name”, “Manager ID”. To count the subordinate of each manager, I tried to self-joining between the 2 tables. Am I right? Also, if I want to join with other table…
Multiple inserts of multi-valued subqueries
I found the single insert answer from this question: How can I insert values into a table, using a subquery with more than one result?. However, I’m looking for a way to do multiple inserts in this fashion. Single-Insert version WORKING! (using the previous answer…): Multi-Insert version (Failing)…
how to resolve this type of error when inserting a new row in a table?
CREATE OR REPLACE TYPE hypothesis AS TABLE OF VARCHAR2(20); / CREATE OR REPLACE TYPE Hypoth_pr AS OBJECT (prob_content VARCHAR2(20), pr NUMBER); / CREATE OR REPLACE TYPE Hypoth_po AS OBJECT (…
Trying to update column on postgresql
I am trying to update my table from another tmp table called fake_email but when I ran the following: update users SET email = fake_email2.email FROM fake_email2 where users.id = fake_email2.id I …
How to shrink x number of columns into a finite number of columns
I have a set of survey results of which one question asks for a contact reason. There are 35 potential responses and the user can select a maximum of five. The results of the survey are stored in 35 columns with (1,null) denoting a positive/negative response. How do I shrink the 35 columns results down into t…
How to fix aggregate functions are not allowed in GROUP BY?
I have the following data: Then i do the following query: The result is correct: Then i add two column, name and value: That return: What i expect is: If i add group by on guid_count, cuid_count, and umdid_count: How to overcome this problem? Could you help point me where my mistake is? Thank you. Answer You …
Can SQL replicate Excel’s auto-updating cells based on other cells? [closed]
I have a database of some devices, each with details on their status for things like maintenance schedule, last calibration date, age, warranty status, etc. One of the points of this database is to …
List only repeating names
| personid | first | last | section | | 1 | Jon | A | y3 | | 2 | Bob | Z | t6 | | 3 | Pat | G | h4 | | 4 | Ron | Z | u3 | | 5 …
In BigQuery, match two tables according to a calculated value of one table
I have two tables in BigQuery: one containing the places of road cameras, named cameras… …and another containing accidents, named accidents. I need to inspect how many accidents happened in the range of 0.5 mile before and 0.5 mile after the cameras. So, what I need to do is: Establish a .5-mile p…