BEGIN
# Count the number of templates used in video
UPDATE VideoTemplate vt
INNER JOIN (
SELECT
TemplateId,
COUNT(TemplateId) AS TotalCount
FROM
VideoWorks
WHERE
Type = 1
GROUP BY
TemplateId
) work_total_count
ON vt.Id = work_total_count.TemplateId
SET vt.RenderTotalCount = work_total_count.TotalCount;
END

-----------------------------------------------------------------------------------------------------------

BEGIN
# Count the background sounds used in the synthesis , The host , Number of text examples
UPDATE VideoBgm vb
INNER JOIN (
SELECT
BgmId,
COUNT(BgmId) AS TotalCount
FROM
VideoWorks
WHERE
Type = 1
GROUP BY
BgmId
) work_total_count
ON vb.Id = work_total_count.BgmId
SET vb.UseCount = work_total_count.TotalCount;

UPDATE VideoTextExample vte
INNER JOIN (
SELECT
TextExampleId,
COUNT(TextExampleId) AS TotalCount
FROM
VideoWorks
WHERE
Type = 1
GROUP BY
TextExampleId
) work_total_count
ON vte.Id = work_total_count.TextExampleId
SET vte.UseCount = work_total_count.TotalCount;

UPDATE ChannelAndSpeaker s
INNER JOIN (
SELECT
SpeakerId,
COUNT(SpeakerId) AS TotalCount
FROM
VideoWorks
WHERE
Type = 1
GROUP BY
SpeakerId
) work_total_count
ON s.No = work_total_count.SpeakerId
SET s.UseCount = work_total_count.TotalCount;
END

Mysql More related articles stored

  1. Mysql Storage engine and selection method

    0x00 Mysql Database commonly used storage engine Mysql Database is an open source database , Support the choice of multiple storage engines , For example, the most commonly used storage engines are :MyISAM,InnoDB,Memory etc. . MyISAM Storage engine My ...

  2. Mysql Storage engine comparison

    Mysql As an open source free database , It is often used in ordinary projects , In the project, our focus is generally on the design and use of the database rather than mysql Itself , So I'm talking about mysql The storage engine of , I don't usually know , Here through the online related articles ...

  3. MySQL One of the storage engines Myisam and Innodb Summative carding

    Mysql There are two storage engines :InnoDB And Myisam, The following table is a simple comparison of the two engines   MyISAM InnoDB The difference in composition : Every MyISAM Store three files on disk . first The name of the file starts with the name of the table ...

  4. MySQL The practical application of storage engine and its effect on MySQL A description of the unique characteristics of the main storage engines in the database

    MySQL The practical application of storage engine and its effect on MySQL A description of the unique characteristics of the main storage engines in the database : 1.MySQL There are a variety of storage engines : MyISAM.InnoDB.MERGE.MEMORY(HEAP).BDB(Berk ...

  5. 【 turn 】mysql Storage engine

    http://www.cnblogs.com/kevingrace/p/5685355.html Mysql There are two storage engines :InnoDB And Myisam, The following table is a simple comparison of the two engines   MyISAM In ...

  6. Mroonga 3.0.8 Release ,MySQL Storage engine

    Mroonga 3.0.8 Support REPAIR TABLE Support for damaged groonga database . Mroonga It's a MySQL Storage engine , be based on Groonga, Provide a complete full text search engine .

  7. Mysql One of the storage engines TokuDB And its data structure Fractal tree( Fractal trees )

    At present Mysql In the database , The most widely used is innodb Storage engine .innodb It's a really good storage engine , Even high performance Mysql They all said it. , If there's no special requirement ,innodb Is the best choice . Of course , This is partial to the text ...

  8. The first 3 Chapter MySQL Introduction to storage engine

    The first 3 Chapter MySQL Introduction to storage engine Preface 3.1 MySQL Storage engine overview MyISAM The storage engine is MySQL The default storage engine , Also present MySQL One of the most widely used storage engines . His predecessor was us in ...

  9. MySQL Storage engine summary

    MySQL Storage engine summary author : Jelly thought typeface :[ increase   Reduce ] type : Reprint   This article mainly introduces MySQL Storage engine summary , This article explains what a storage engine is .MyISAM.InnoDB.MEMORY.MERGE Wait a minute ...

  10. MySQL Storage php in json_encode Format Chinese problems and solutions

    MySQL  Storage php in json_encode Format information   , When it comes to Chinese ,  It's going to be a bunch of things like that uxxxx Information . 1.  Cause analysis : When stored in a database !MySQL  Will not store  unicode  character : MySQL  only ...

Random recommendation

  1. Objective-C( Foundation frame One Array (NSMutableArray))

    NSMutableArray: Variable array NSMutableArray yes NSArray Subclasses of establish NSMutableArray Array objects Add array elements : // Create array NSMutableArray *a ...

  2. Reprint : of SQL server connection KeepAlive Of FAQ

    turn :http://blogs.msdn.com/b/apgcdsd/archive/2011/05/03/sql-server-connection-keepalive-faq.aspx 1. What is? S ...

  3. [51NOD1065] The least positive subsegment and (STL, The prefix and )

    Topic link :http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1065 No one's doing that, I guess - Use one set Maintain prefixes and , however set Of l ...

  4. synchronized Summary of key words ( One )

    1. synchronized Synchronization method 1) synchronized Modification methods , Representations are synchronous , When a thread enters and gets the lock of the current object a. other synchronized Methods queue and wait for lock b. Not sync ...

  5. Unity3D So many fbx Import scene , Merge multiple animations

    1: Import to the appropriate folder first , Unity Automatically refresh , Generate the corresponding file . 2: stay Project Select a single... In the view fbx, stay Inspector Choose from "Rig", change "Animat ...

  6. a ORA-00471 processing method

    The company has a new one on the shelves to serve the computer room , The hardware is IBM X3850 X5, The hardware configuration is good , Memory has 128GB.SA Install the system --( edition sule 32bit) After the notification I can install the database . Busy for a long time , Install well oracle 92 ...

  7. iOS UIButton Detailed introduction

    yesterday , Did a little bit of the project , I think details are still very important . Like an ordinary UIButton, Debug the font format for it , Size or something , It's really time-consuming . I'm going to summarize it in detail today .. typedef NS_ENUM(NSInteg ...

  8. md5sum Verify file integrity

    1. brief introduction MD5 Algorithms are often used to verify the integrity of network file transfer , Prevent documents from being tampered with . MD5 The full name is the message digest algorithm (Message-Digest Algorithm 5), This algorithm calculates information of any length bit by bit , produce ...

  9. Java Environment settings

    Java Environment settings Local environment settings If you still want to work for Java Programming language setting environment , So this section will show you how to download and set up Java. Please follow these steps to set the environment . Java SE It can be downloaded from Java ...

  10. SpringJDBC Of JdbcTemplate stay MySQL5.7 Sub queries are not supported under

    org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [ SELECT ...