Using multiple tables for lookup in MySQL
I'm normally pretty good at finding the answer I need by searching, but I'm drawing a blank on this one. Let's say I have two tables that both have a list of names and ID numbers (we'll call them a…
I'm normally pretty good at finding the answer I need by searching, but I'm drawing a blank on this one. Let's say I have two tables that both have a list of names and ID numbers (we'll call them a…
I can create a query to return specific events based on some criteria, but is it then possible to query for all events with a timestamp within 2 minutes of each of the events returned from the original query? For…
I have a table where I want to add a new column based on the result. If I create the following query it works correctly as all the tables appear plus a new call RESULT SELECT ID, CASE WHEN RESULT_HOME…
+----------+------------+ | id | name | +----------+------------+ | 1 | storeone | | 2 | storetwo | | 3 | storethree| +----------+------------+ +----------+------------+------------+ | id | storeid | date | +----------+------------+------------+ | 1 | 1 | 2024-07-01 | | 2…
I have the following table: id | name 1 | Group1 2 | Group2 .. | ... I want to join it with another table this way: id | group_1 | group_2 | .. 1 | 10 | 8 |…
I can't connect my directus project with mysql server. Getting connection refused error. However when I'm running this command, I'm able to connect: mysql -u root -p -h localhost -P 3306 My docker-compose.yml file: version: '3' services: directus: container_name: directus…
I try to insert values into a new table. This is the insert with certain date format (dd/mm/yyyy h:m): INSERT INTO `sport` (`TIME`, `HOME`, `VISIT`, `HOME_RESULT`, `VISIT_RESULT`) VALUES ('20/07/2024 19:15','Dortmund','Bayern','5','3'); and this is the create table scheme: CREATE TABLE `sport`…
The cancellation rate is computed by dividing the number of canceled (by client or driver) requests with unbanned users by the total number of requests with unbanned users on that day. Write a solution to find the cancellation rate of…
In a PHP application I am trying to the users information from the table like below session_start(); $sql = "SELECT * FROM users WHERE company_id = $_SESSION['companyId']"; $result = $connect->query($sql); but query statement in bold throws syntax error. syntax error,…
I have a simple database with the user and the country tables. Which user belongs to only one country. Which country has a list of users. Right now Im using group_concat (code below) and its working in a "manual" way…