My query is I get the error java.sql.SQLSyntaxErrorException: ORA-01797: this operator must be followed by ANY or ALL whenever i run it, What does it mean and how can I fix it ? Answer Your code is very messy and should be cleaned up. When asking the questions here you usually should create a MRE in which the…
How to give names to output tables?
I need to do a JOIN using two ouput-tables (these tables result from previous operations using other tables). I want to give them specific names to reference them. I’ve try ALIAS, AS, INTO, but nothing works. I am new in SQL and I’d really like some help here. My code is the following I’d li…
Compare the sums of 2 separate columns with an SQL Statement
I need help with the following code: Issue with the code: The resultant table contains only NULL in the delay fields. I’m unsure why this happens, as removing ArrivalsDelay and DeparturesDelay from the GROUP BY results in the SELECT failing, as I’ve not included ArrivalsDelay in the GROUP BY which…
How do you use mysql to only return a record if no conflicts exist?
Is there a way to have a SELECT statement only return a result if there exist no records in the database that conflict with the conditions? For example, people can reserve a table for two-hour blocks. A new reservation should only be allowed if there are no reservations that overlap with the new request. Some…
Invalid syntax error near ‘<' when using case when variable, works fine without variable
I am trying to resolve this SQL issue where my code throws an error Invalid syntax error near ‘<‘ when I use the variable @totalprice. Without using the variable, the CASE works and the query executes correctly but I want it as a variable Thanks Answer If you want to assign the result of the CA…
How to summarize multiple fields in sql
How can I V1,V2,V4,V5 already summarized data as v1,v2,v3,v4. How can I sum v1+v2 and v4+v5 and GTOT +———————————————————+ | Name | V1 | V2 | V1+V2 | V4 | V5 | V4+…
SQL PROCEDURES – Multi inserts
I’m trying to create SQL procedure that registers a user to the system. for that the user details need to save to a lot of tables, i make this procedure and its work but returns me an error: 14:47:53 …
passing a parameter to a function; Subquery returned more than 1 value. This is not permitted
I want the function to return age of the employee in specified date passed to the function by parameter DROP FUNCTION IF EXISTS dbo.f_Employee_Age; GO CREATE FUNCTION f_Employee_Age(@date DATE) …
Multiple Sequence in SQL Oracle / Varchar2 ID with letters and digits
I am trying to ‘generate’ a Varchar ID that contains letters and digits too with a sequence, but I think there will be more sequences than one. What I am looking forward to is something like this ‘…
How to handle repeated records in SQL?
I have a simple data set like below: Employee Data I need minimum start date & max end date of an employee whenever there is a dept id change or status code change. So i wrote this formula for Min …