Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT *
- FROM
- /* DDD */
- (SELECT historyid, url, title, guid, domain_id, domain, localvisitdate, remotevisitdate, localvisitcount, remotevisitcount, iconid, iconurl, icondate, icontype, iconwidth, frecencies, is_bookmarked
- FROM
- /* CCC */
- (SELECT historyid, url, title, guid, domain_id, domain, Max(localvisitdate) AS localVisitDate, Max(remotevisitdate) AS remoteVisitDate, Sum(localvisitcount) AS localVisitCount, Sum(remotevisitcount) AS remoteVisitCount, Max(frecency), Sum(frecency) AS frecencies, 0 AS is_bookmarked
- FROM
- /* BBB */
- (SELECT *,
- ( ( ( 2 + localvisitcount ) * ( 2 + localvisitcount ) ) * Max(2, 100 * 225 / ( ( ( 1513210113245088 - localvisitdate ) / 86400000000.0 ) * ( ( 1513210113245088 - localvisitdate ) / 86400000000.0 ) + 225 )) + remotevisitcount * Max(1, 100 * 110 / ( ( ( 1513210113245102 - remotevisitdate ) / 86400000000.0 ) * ( ( 1513210113245102 - remotevisitdate ) / 86400000000.0 ) + 110 ) ) ) AS
- frecency
- FROM
- /* AAA inner history */
- (SELECT history.id AS historyID, history.url AS url , history.title AS title, history.guid AS guid , domain_id, domain, Coalesce(Max(CASE is_local WHEN 1 THEN date ELSE 0 end), 0) AS localVisitDate, Coalesce(Max(CASE is_local WHEN 0 THEN date ELSE 0 end), 0) AS remoteVisitDate, Coalesce(Sum(is_local), 0) AS localVisitCount, Coalesce(Sum(CASE is_local WHEN 1 THEN 0 ELSE 1 end), 0) AS remoteVisitCount
- FROM (select * from history
- INNER JOIN domains ON domains.id = history.domain_id
- INNER JOIN visits ON visits.siteid = history.id
- LEFT JOIN view_all_bookmarks ON view_all_bookmarks.url = history.url
- WHERE (( ( history.url LIKE '%git%' ) OR ( history.title LIKE '%git%' ) ))
- AND view_all_bookmarks.url IS NULL) as history
- GROUP BY historyid)
- /* AAA */
- WHERE ( ( ( localvisitcount > 0 ) OR ( remotevisitcount > 0 ) )
- AND ( ( localvisitdate > 1497485313245106 )
- OR ( remotevisitdate > 1497485313245106 ) ) )
- ORDER BY frecency DESC
- LIMIT 1000)
- /* BBB */
- GROUP BY historyid
- ORDER BY frecencies DESC
- LIMIT 100)
- /* CCC */
- LEFT OUTER JOIN view_history_id_favicon ON historyid = view_history_id_favicon.id
- ORDER BY frecencies DESC)
Add Comment
Please, Sign In to add comment