I’m trying to run a pretty simple script that does the following: Takes the id of a content module and assigns it to multiple locations So say I click the link on a content module with ID of 123, I …
Tag: mysql
Filter data by multiple rows in second table MYSQL
I have 2 tables. users and users_meta. I want the query to return all users that have sexe=M and user_att1=1 (which should return only mathew) but I also need to be able to filter by other attributes …
Using CASE WHEN DATE Statement in MariaDB 10.2.15
I created a query to display the ScanIn Field in one month on each date Code : SELECT Employee.Name, CASE WHEN DAY(LogsFormatted.DateIn) = 1 THEN LogsFormatted.ScanIn ELSE ‘-‘ END AS ‘1’, …
Fetching constraints in SQL database to JSON in PHP
Let’s assume I have the following database structure of car manufacturers and the corresponding cars: manufacturers: cars: The id column of manufacturers is the primary key and the manufacturer column of cars has the corresponding foreign key constraint. I’d like to produce the following JSON outp…
Update large table from smaller, mission critical, table without locking small table
In MySQL, I have two innodb tables, a small mission critical table, that needs to be readily available at all times for reads/writes. Call this mission_critical. I have a larger table (>10s of …
Count child members from parent value
I have a table like conversations and conversation_timelines conversations table example | id | last_active | category_id | |——————————————-| | 1 | …
Model not returning value when one field used in select
I have a question with my if statement. I want to get check what is bigger than another price value. one value is saved in my database table and another one is getting with input value. but I wrote …
Descending not working in query, but it should work? [closed]
I am making a scoreboard for my internship, for the games we play in the break. I have a really big query to get the results of all games and count the total of wins by players. SELECT winner, SUM(…
How to avoid adding duplicate foreign key constraints
I would to know if it is possible to avoid adding several times the same foreign key constraint? Example: if I execute 3 times the query below, the constraint will exist with 3 times in phpmyadmin… It would be great that it would be rejected the second and third time I apply that query. Answer You can g…
MYSQL Procedure not getting called
The Following procedure after getting called, shows up error “The Result return more than one row” where the input value given is just one parameter. DELIMITER $$ CREATE PROCEDURE p( IN en …