This new demand to add folders, engaged in a few days finally understand a little, here and everyone to share the problems I encountered, I hope we can take less detours.
Since our framework uses SSH, some of the SQL statements are not supported, only support HQL, so the first query two tables of some useful fields, one table is user_video_folder another table is user_video the two tables through union all for joint query, I have an article in front of the Union and Union all of the difference, you can go to the view, here is no longer introduced.
The first time through the statement query: The following statement:
SELECT V.folderid, ' folder ' as TYPE, ' error ' as error, ' percentage ' as percentage, ' access ' as Access, ' duration ' as duration, ' up Loadtime ' as Uploadtime, ' Videostatus ' as videostatus,v.userid,v.foldername from User_video_folder v UNION all SELECT p.us Ervideoid, ' video ' as TYPE, Error,percentage,access,p.duration,uploadtime, videostatus,p.userid,p.videoname from User_ Video P
This statement is normal, you can find out the required fields, just at the beginning is hql the varchar field for the Federated query will give an error: Here is the solution link:
http://blog.csdn.net/itzhanghao/article/details/47099881
Now the string type has been resolved, but another problem has arisen. is time and DateTime. It is normal to display the results through a statement query. However, the JSP page does not display properly. In the end, I debugged a lot of scenarios and finally decided to do type conversions when querying:
The first is time conversion: Date_format (p.duration, '%h:%i:%s ')
DateTime conversion, Date_format (Uploadtime, '%y-%m-%d%h:%i:%s ') This solves all the display problems.
。
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
MySQL takes time, datetime field displays problems