I am trying to collect counts of different columns for players (you don’t need to know the ins and outs of all the columns). We have a player_1 and player_2 column so I have made it distinct to get total counts, as you can see below: I want to also get the frequency of goals for last 32 games for
Tag: mysql
Binding an unknown number of keywords to a SQL statement with wildcards
I want to bind keywords to a SQL query like this: Note that the number of keywords is NOT predetermined. It is in fact determined by an array which itself is determined by exploding user’s input on space. I am using Laravel 7. So, I am looking for a solution that is consistent with Laravel 7 and PDO. Th…
“From is not valid at this position” this is the syntax error I am getting while using Update join in mysql-Workbench
enter image description hereI want to update the Paid column in Product when payment amount get inserted with respect to the product… create table Product( PID INT primary key, Paid int not null …
Optimising query with multiple selects as columns
I have a query I made: The results table has 25000 entries and it takes around 7 seconds to do this query, which is far too long. The query is incredibly inefficient as each column I’m creating is searching again on the same table but with different conditions. I tried indexing the columns of interest i…
MySQL Attendance IN & OUT columns with correct times
I have a database for attendance, it works fine as long as the person does not work over 2 dates. I want to utilize IN and OUT system for records but I do not know how to do the final step, and what I …
mySQL foreach row run an update
Progress table has progressId, lessonId and uniqueId TestResults table has progressId TestResults table now has lessonId and uniqueId This SQL statement foreach progrssId in TestResults will get lessonId and uniqueId from Progress: Now I want to update lessonId and uniqueId in TestResults table foreach associ…
SQL count rows where column value contains string
I want to count the number of rows where a certain column has a substring in the column value. This doesn’t work Example: I want to count the rows including ‘no’ Expected result: 2 Because ‘no’ is a substring in ‘noa’ and ‘noit’. Answer Use a case expressi…
How to select matching results with other random results in mysql
I want to select all the matching results in a database table with also random results but with the matching results being at the top. With the way, I am doing now I am using two queries first one being the matching query, and if the count is zero I now select random results. I would like to do this
Search Engine Developement using MySQL relevancy, not working on PHP
i’m working on search engine developement. I’m kinda struggling with an SQL/PHP request. I’m trying to get the highest relevancy score from a search query. It works perfectly on SQL, but not at all on PHP, neither on localhost nor online (while the source code is generated by phpmyadmin itse…
MySQL – Slow query
Sorry for the long post, but the tables involved are quite big. When I run the query bellow it normally takes about 1m to run. However, when I remove the correlated sub-query I get the query down to 15 seconds. So I think that’s the actual problem. Problem is, I don’t really know how to get the SU…