mysql-5.7

How can i count project status by change/update made

随声附和 提交于 2019-12-24 20:58:09
问题 I want to count status change by id from to I have a mysql status table which has a name with pre implementation, implementation and operations states. a project contains project id, name, start date fields. both status and projects have a many to many relationship called project_status table contains project_id, status_id, date_of_progress. so i want to count all projects within this month who has update/change their status_id from pre-implementation to implementations from implementations

How do I sum only the 3 best scores from this query?

坚强是说给别人听的谎言 提交于 2019-12-24 20:43:57
问题 I need to sum only the 5 best scores for each player from 11 events. The query below creates a leaderboard which sums all the scores but I'm stuck as to how i can only sum the 5 best scores. I've abbreviated the query to show only 4 events and getting best 3 results to shorten the post, but hope it gets across, what I need. SELECT playerID AS Player, SUM(CASE WHEN championshipleaderboard.eventID = 1 THEN championshipleaderboard.points ELSE 0 END) AS Event1, SUM(CASE WHEN

how can i count status changed/updated by categories for a specific month

落花浮王杯 提交于 2019-12-24 19:59:09
问题 i want to count projects status updates/changes for a given month by categories names I have a categories (list of category), investment (list of investors investments including category_id from categories), status table which has a name with pre implementation, implementation and operations states. a project contains project id, name, start date fields. both status and projects have a many to many relationship called project_status table contains project_id, status_id, date_of_progress. I

SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: '2019-03-31 01:52:25'

无人久伴 提交于 2019-12-24 10:23:38
问题 I'm currently receiving lot's of errors from more than one production database that I maintain saying: SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: '2019-03-31 01:49:45' for column 'created_at' at row 1 This is my table: +------------+--------------+------+-----+-------------------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------+--------------+------+-----+-------------------+----------------+ | id | int(11) | NO | PRI | NULL | auto

Mysql 5.7.20: Cannot create a JSON value from a string with CHARACTER SET 'binary'

心不动则不痛 提交于 2019-12-22 13:57:17
问题 I am facing this issue when importing an SQL file with a table with JSON column. The database has Encoding: utf8mb4 Collation: utf8mb4_unicode_ci Here's the table with the json column: CREATE TABLE `tracking_data` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `route` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `data` json NOT NULL, `user_id` int(10) unsigned NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE

How to check Data Dictionary size in MySql

泄露秘密 提交于 2019-12-22 09:25:34
问题 How to check my current data dictionary cache size? FYI: -> Data Dictionary cache - which stores open tables information. So that the data dictionary cache increases depends upon the number of open tables. -> table_open_cache is an variable which holds a value that mysql can have total number of open tables. Im asking the current data dictionary size which has the data of open tables. (Status of current data dictionary size). MySql version - 5.7.18 回答1: The number of table definitions that

Update user password in Mysql 5.7

和自甴很熟 提交于 2019-12-21 04:50:18
问题 I wrote an installation script to change the root password with this SQL command: UPDATE user SET password='*C563415623144561...' WHERE user='root'; This doesn't work on Mysql 5.7: http://dev.mysql.com/doc/relnotes/mysql/5.7/en/news-5-7-6.html#mysqld-5-7-6-account-management My question is: how to change this command with another one compatible with 5.6 and 5.7 version of Mysql? I would like to update the password with a hashed string and not with a clear password. 回答1: This is no more

Poor whereHas performance in Laravel

≯℡__Kan透↙ 提交于 2019-12-20 09:01:13
问题 I want to apply a where condition to relation. Here's what I do: Replay::whereHas('players', function ($query) { $query->where('battletag_name', 'test'); })->limit(100); It generates the following query: select * from `replays` where exists ( select * from `players` where `replays`.`id` = `players`.`replay_id` and `battletag_name` = 'test') order by `id` asc limit 100; Which executes in 70 seconds. If I manually rewrite query like this: select * from `replays` where id in ( select replay_id

MySQL 5.7 STR_TO_DATE

ⅰ亾dé卋堺 提交于 2019-12-20 07:14:51
问题 I am running MySQL 5.7 and wanted to convert some strings to date. I referred the manual here: http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html#function_str-to-date And tried out the following(please note the MySQL version) mysql> SELECT STR_TO_DATE('9','%m'); +-----------------------+ | STR_TO_DATE('9','%m') | +-----------------------+ | NULL | +-----------------------+ 1 row in set, 1 warning (0.00 sec) mysql> show warnings; +---------+------+-----------------------------

MySQL: Invalid GIS data provided to function st_geometryfromtext

…衆ロ難τιáo~ 提交于 2019-12-19 09:14:33
问题 Here's my code: SET @poly = 'Polygon((-98.07697478272888 30.123832577126326, -98.07697478272888 30.535734310413392, -97.48302581787107 30.535734310413392, -97.48302581787107 30.123832577126326))'; SELECT name FROM county_shapes WHERE MBRContains(ST_GeomFromText(@poly), SHAPE); Whenever I run that I get a "MySQL: Invalid GIS data provided to function st_geometryfromtext" error. This returns the same error: SELECT name FROM county_shapes WHERE MBRContains(ST_GeomFromText('Polygon((-98