Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago. Improve this question I’d like to create a report that has columns like Year, Month, Earni…
MYSQL: Insert with Select not working properly
I can’t seem to debug this issue. I am currently running to set person_id to -1, but also utilize a select statement with this person_id value. Using this statement, I cannot find any reason online …
Update one column only when any other column change
I am trying to create an update statement on SQL Server to set one of the cards as default and all the others as not, however, if I have 3 cards and card 1 set to default and now I want to set card 2 …
Find duplicate email and copy value from one row and insert it another row with same emails in MySQL
i have user table which has four columns(id , email ,phone , status ) . i trying to copy phone number from one row by email and insert it in another row with same duplicate email where status is 1. …
Use group by in select from nested queries
I want to run a query similar to the following SELECT t.ticketid, Min(oo.incidentid). max(t.createddate) FROM (SELECT ticketid, NAME, createddate …
Query table using multiple foreign keys
So I’m just messing around with a NodeJS application, and I’m trying to implement a permission system using my database. It’s my first time working with any kind of SQL environment, so please correct me if I’m doing something terribly wrong. I have the following tables: So there are 2 …
Removing duplicates from Join with grouped result
I use an sql server with EF Core. Due to lack of GROUP BY support by EF I run raw sql query. So, I have a history table +————+———+——————+ | HardwareId | StateId | …
Search for exact string value in JSON
I have a column stored in JSON that looks like column name: s2s_payload Values: I want to query exact values in the array rather than returning all values for a certain data type. I was using JSON_EXTRACT to get distinct counts. If I want to filter where “”eventtype””:””sea…
Laravel and Eloquent – applying different filters
I’m feeling stuck. 🙁 I want to be able to execute different SQL query, depending on the selected filters in my form: //My initial query without any filters is this: $dbQuery=”SELECT * FROM “…
Parsing Time field from Postgres db in rails 6 to retrieve hour and minute?
I have a model Open times for shops. The open times tables comprises a field as below. I would like to query the opening and closing times like: 08:00 – 17:00 t.time “closes” the view helpers is …