How to delete rows from my customer table depending on values from another table, let’s say orders? If the customer has no active orders they should be able to be deleted from the DB along with their rows (done using CASCADE). However, if they have any active orders at all, they can’t be deleted. I thought about a PLPGSQL function,
Oracle – How use string data in (in operator)
In tbl_1 I have: Select * from tbl_1 where id in (Select value from tbl_2 where id = 2); –is OK Select * from tbl_1 where id in (Select value from tbl_2 where id = 1); Answer Yet another option:
SELECT data grouped by WEEK in SQL
I have a working query (ORACLE SQL) that gives me gallons grouped by store number, with gallons summed by type and a percentage column as well. Each store number has a different conversion date from which I sum up the data – I now need to also sum it up by week, with Sunday being the first day of each
SQL oracle SUM function with conditions
I have a table that looks like this TIMECODE UNIT_CODE Department Account AMOUNT 20194 10 1000 1000 100 20194 10 2354 1100 …
Load dynamic values into msgHTML in phpmailer body from database
What I am trying doing here is inserting and sending the number of orders via SMTP phpmailer. I am using foreach to separate the order data into key value pair and inserting into the database. can …
Group rows based on column values in SQL / BigQuery
Is it possible to “group” rows within BigQuery/SQL depending on column values? Let’s say I want to assign a string/id for all rows between stream_start_init and stream_start and then do the same for the rows between stream_resume and the last stream_ad. The amount of stream_ad event can differ hence I can’t use a RANK() or ROW() to group them be
Constraint for self-referencing columns based on row value in another column – postgres
I have a table like user_id | team | role | reports_to ___________________________________________ lion carnivore manager tiger carnivore lead lion …
What cause SQL syntax error in creating table in database
When creating a table in mysql query I get the error as below. I could not understand what is causing this error. The query is as below. Answer You appear to be using Java types in your create table statement. Try using proper MySQL types and it should work:
How do I get Id in the URL to display comments with Symfony 5?
I’m coding a blog with Symfony 5 and I have issues getting the Id from the URL to display comments from my Database. To sum up : – I have a view “/fiche/{id}” wish displays specific game informations. – People can leave a comment below, the comment goes in Database with a foreign Key named “jeu_id” wish is the game
insert values in the last column for my table from another table
Hi I’m trying to insert values in the last column for my table from another table but am getting error ERROR: null value in column “name” violates not-null constraint DETAIL: Failing row contains (ddf1caf0-26c2-49e1-8a73-64227eae1f50, null, null, null, null, null, 2532). Answer I suspect that you want to update the column subsystem of the table software_instances with values of the column