So I have three tables as follows: Members -> id, userId, accountId Account -> id, name User -> id, firstName, lastName, email INSERT INTO `account` (`id`, `name`) VALUES (‘1’, ‘xyz company’), (‘2’…
Error: ‘duplicate key value violates unique constraint’ even when checking with ‘where not in’
I get the error: ‘duplicate key value violates unique constraint’ even when checking if the primary key is already in the table in which I want to insert. I have tried to check with either ‘where not y.a in…’ as well as with ‘where not exists…’ The code I use ri…
SQL – Variable formule to calculate prices
I’m in need of the correct code syntax that calculates the price after discount for the following 4 scenarios. Please note that I’m looking for a variable solution as the amount of commas in the …
Exclude records from query based on two joined tables results
I have an app that is used to inspecting residence rooms at a university. Staff goes through the rooms and inspects based on the list of inspection items and marks the condition as a pass or fail. every inspection has 25 detail lines that can be marked with a pass or fail table 1 is the inspection table insp_…
Adding output to function PL/SQL
I am trying to get my function to include the date and current user, but I keep getting an error that my function is in an invalid state. If I comment out or remove the two dbms_output… lines it works just fine. Any ideas of how to return that output? Using Oracle SQL Developer Answer You have to declar…
Laravel save a input with extra value data
i am trying to save a input value from a time data: On mi example i am saving the data 3:30 for a calendar form, but to use on the calendar i need save …
Trying to connect two tables together by using id value from one table on the other
So i’m pretty new to sql and i’m trying to figure out how to connect two tables together. I have a table named customers and a table named pets and i want to assign the pets to specific customers. I am able to assign them a customer value but only as the id, i can’t figure out how to take
If a combo box = specific text then display in text box current date
If a combo box = Closed, rejected or cancelled then display today’s date in text box. for example I have a combo box that has closed open rejected and cancelled. If someone chooses closed rejected or canceled then I need a text box to display the current date. I tried the below code but not sure where t…
How to manipulate the output after selecting and ordering TOP RESULT
ERROR: Msg 156, Level 15, State 1, Server NS544979, Procedure , Line 0 Incorrect syntax near the keyword ‘TOP’. [42000] [Microsoft][SQL Server Native Client 11.0][SQL Server]Incorrect syntax near the keyword ‘TOP’. (156) I have successfully selected and ordered the PvPExp in the query.…
Breaking Groups into 3 buckets based on whether or not one field has any 0s
I have events that are being treated differently based on whether or not expenses have 0 attendees. Each event has a unique code with several expense line items. If the attendee field has ALL 0 for each expense in this event code, then I need to append the method field to say method 1, for each expense with t…