I have a below table in mysql. DROP TABLE IF EXISTS `mdc_data`; CREATE TABLE `mdc_data` ( `id` int(11) NOT NULL AUTO_INCREMENT, `tariff_id` int(11) DEFAULT NULL, `msn` varchar(100) DEFAULT NULL, `…
Tag: mysql
Syntax error possibly due to multiple ANDs?
UPDATE bookings b SET reservation_processed = ‘archived’ JOIN reservation_time_data r ON r.id = b.reservation_time WHERE premises_code = ‘LJJIDHhRN2ho1e3h’ AND reservation_date LIKE ‘%2020-09-10%’ …
Find an entry in sql dependent on other entries in the table
How can I return all entries in a table that contain a string in a given column if the same string is also present in the same column with a given suffix ? So for example, given the suffix ‘bar’, and …
how to improve mysql query speedy with indexes?
I must run this query with MySQL: select requests.id, requests.id_temp, categories.id from opadithree.requests inner join opadi.request_detail_2 on substring(requests.id_sub_temp, 3) = …
how to combine multiple rows into one row?
My table: What i want to get is: Is there any simple way for this? Answer If you are using MySQL 8+, then ROW_NUMBER combined with pivoting logic provides one way:
SQL pivot query to get the result in a single row
I have a users table as I have another user_custom_fields table as and a third custom_fields table Here the problem is I need the result for each user in a single row with all the custom field_name as column header as I have heard about pivot queries but I don’t have much knowledge of SQL. Can anyone he…
How to select and update row, so that the same row could not be selected again by any user?
I am sending sms to mobile numbers using many apis at the same time, now I want to ensure that only one sms should be sent to one mobile number. I am selecting a row using the following query while selecting the row I want to set field i_sms_sent_count to 1 so that this row could not be selected again
Display a record although the condition return zero record
I have MySql query like this: SELECT name, id_number, hr.id, file, created_at, updated_at From users u LEFT JOIN homework_targets ht on u.class_id = ht.class_id LEFT JOIN homework_replies hr on u.id =…
Develop a single host multiple client MYSQL database
Please forgive me if the title is not correct. I am still trying to understand how this works. I have installed MySQL workbench and the MySQL server on my laptop. I have successfully created a database that store driver details, as per the picture. I can access this info only one my laptop. However, I would a…
How to make an SQL query to get only 1 row with specific data?
I have the following MySQL query: SELECT work_from, work_until, restaurant_id, from_date, to_date FROM restaurant_working_times WHERE restaurant_id = ? and restaurant_id is not null and `week_day` …