Suppose, I need to delete or update some id informations from my database, which would be the best way to do it? Should I first find out that if that id exists or not? Or should I update the data then …
Tag: mysql
How can I count unique clicks across jobs for each category
I store link performance attributed to different categories in a sent table like this… CREATE TABLE sent ( customer_id INT, jobId INT, category VARCHAR(100), timestamp DATETIME DEFAULT …
How to left join more than 3 tables [closed]
I’m struggling as a junior to create a view based on 5 tables: Country, Business, SubBusiness, Role and Type CREATE VIEW my_view AS SELECT DISTINCT `a`.`country`, `b`.`business`, `c`.`sub_business`, `…
How to insert SUM() function that sums rows with similar ID in a code part of witch is unchangeable?
I am trying to write a quarry in a module for Dolibarr ERP. But module hase a part of code that is predefined and can not be changed. And I need to insert a SUM() function in it that will combine rows …
Can i use SUBSTR() inside of CAST() method?
I have a table called cities, with a column for timezones ( Timezone VARCHAR(10) NOT NULL that has timezones stored like: +00:00 or -02:00). – I am trying to select all cities that are two hours behind a city belonging to the +02:00 timezone. I want to select the third character of the string and conver…
How to bring columns to a table from another table by the Id?
I have this tables People, Ticket, and Report. I would like to replace the ForeingKey idPeople with columns Name and Age from People table. In the Report table replace the Foreing Key idTicket with ticketCol2, Name, Age from the previous table Ticket with replaced columns (idPeople by Name, Age). And I the re…
getting error in Sql Query incorrect syntax near ‘)’ [closed]
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers. Closed las…
MySQL – ORDER BY multiple words, then alphabetically?
How can I change this part of the query to have multiple words ordered first in sequence, then the rest of the results alphabetically? ORDER BY CASE WHEN name LIKE ‘%Professional%’ THEN 0 ELSE 1 …
How to Bring in Full 24 Month Span (including NULL values) in MySQL Query Count
Attempting to create a ‘Previous Year’ vs ‘Current Year’ Graph using a jQuery plug-in with data from my MySQL database. The data for such is like this var previousyear = [ [1, …
Joining two tables and adding column values together
I have two tables, in both tables I have a unique column titled phone_number and then a column called spring with 3 others columns. The spring column has a number value. This table has about 3000 rows….