I am trying to create a SQL query (or multiple queries and logic in PHP) to insert new rows into MySQL db table (say table name is student) where the rowNum column values always remain chronological dependent on a separate date/time column. This means that if the row I’m inserting has the greatest/max/latest date/time it should be inserted normally and
Ignore hash character in a query on sqlplus
i’ve launched this query on sql developer without error. insert into COMUNICAZIONI_TEMPLATE (ID, DESCRIZIONE, TESTO_TEMPLATE) values (3, ‘TEMPLATE EMAIL NUOVO DOCUMENTO’, ‘Gentile <…
Syntax issue with UPDATE query using WHERE and LIKE
I am trying to update an empty field in my table to show “Spray Guns Service Kit” if the product code field has “ASPASK” in it. This is what I have tried thus far: Access keeps telling me I am updating 0 rows when I should be updating 100s. However, when I change the code to it works but only
SQL count when equation of two columns are true
I have a sheet with rows (id and year). See below: id year 101 2002 101 2006 101 2010 101 2014 101 2018 102 2002 102 2006 102 2010 102 2014 103 2010 I simply want to regroup and reformat my table to look like this: id 2002 2006 2010 2014 2018 101 1 1 1 1 1 102 1
Select if date is older than 30 days. What to do if format is wrong?
I want to select all entries where the column “date” is older than 30 days. The problem is, that I dont have the date saved in a supported format. My date is saved as ‘DD.MM.YYYY hh:mm:ss’. Is there a way to get such a selection within sqlite without changing the give database? Or is my only or better option to
SQL join two tables by modifying on columns
I have 3 tables on PostgreSQL: SPENDINGS: STORE: CUSTOMER: I would love to join these tables like this: How can I do that could you help me out please? Answer trim(store.zip_code) is not good for the job because the whitespace is within the zip code text. Use replace(store.zip_code, ‘ ‘, ”) instead. right(spendings.store, 6) does not seem safe to me
SQL Getting a value from a column where another value is MIN value
I am not that experienced in SQL and I am trying to get a value from a row where another value is the min value. I tried several things and can’t find the answer on this forum. My SQL: So I have a table with all actions a driver has done during the day (Driving, resting, loading,…) and I want
Inserting multiple rows of data into a single column
Absolute SQL beginner here: I have a table ‘students’ with the columns ‘id'(primary key), ‘name’ and ‘mark’. I am now trying to add the marks for a number of students. Just using multiple UPDATE statements like seems rather dull and labor intensive. What would be the most simple and elegant way to execute such an operation using MS SQL? Answer
Join Only Unique Values From 2 Tables
I’m trying to join two MySQL tables, and return only the unique values between them. eg. I want to get as my result a table that only shows the intersections of rows without any duplicates where I’m joining on table1.column1 = table2.column1: Simple joins and unions and I’m ok, but this one is causing me a headache. Edit for clarification:
The native sql query to Postgresql via the @query annotation is not executed
To get the necessary data, I form an SQL query to PostgreSQL, which is a related set of View tables : When I execute these queries from the console in the database sequentially, one after the other, everything works. However, if you run similar queries in the repository via the @query annotation (“… ” , NativeQuery = true), a number