(SELECT d.ID, d.Created, d.Updated AS Updated,
'/modules/gallery/category/ ' AS Link,
'Gallery Category ' AS Type,
p.TabURL AS Section_URL,
'NULL ' AS Category_URL,
d.Category AS Text,
d.CategoryURL AS Page_URL,
a.Forename, a.Surname
FROM gallery_category AS d
LEFT JOIN admin AS a ON d.AdminID = a.ID
LEFT JOIN pages AS p ON p.Type = 'gallery'
ORDER BY d.Updated DESC)
UNION
(SELECT d.ID, d.Created, d.Updated AS Updated,
'/modules/gallery/ ' AS Link,
'Gallery Image ' AS Type,
c.CategoryURL AS Category_URL,
p.TabURL AS Section_URL,
d.ImageAlt AS Text,
d.ImageURL AS Page_URL,
a.Forename, a.Surname
FROM gallery_details AS d
LEFT JOIN admin AS a ON d.AdminID = a.ID
LEFT JOIN gallery_category AS c ON c.ID = d.CategoryID
LEFT JOIN pages AS p ON p.Type = 'gallery'
ORDER BY d.Updated DESC)
UNION
(SELECT d.ID, d.Created, d.Updated AS Updated,
'/modules/links/category/ ' AS Link,
'Link Category ' AS Type,
p.TabURL AS Section_URL,
'NULL ' AS Category_URL,
d.Category AS Text,
d.CategoryURL AS Page_URL,
a.Forename, a.Surname
FROM links_category AS d
LEFT JOIN admin AS a ON d.AdminID = a.ID
LEFT JOIN pages AS p ON p.Type = 'links'
ORDER BY d.Updated DESC)
UNION
(SELECT d.ID, d.Created, d.Updated AS Updated,
'/modules/links/ ' AS Link,
'Link ' AS Type,
c.CategoryURL AS Category_URL,
p.TabURL AS Section_URL,
c.CategoryURL AS Category_URL,
d.Title AS Text,
a.Forename, a.Surname
FROM links_details AS d
LEFT JOIN admin AS a ON d.AdminID = a.ID
LEFT JOIN links_category AS c ON c.ID = d.CategoryID
LEFT JOIN pages AS p ON p.Type = 'links'
ORDER BY d.Updated DESC)
UNION
(SELECT d.ID, d.Created, d.Updated AS Updated,
'/modules/address/ ' AS Link,
'Module ' AS Type,
'Address ' AS Section_URL,
'Address ' AS Category_URL,
'Address ' AS Page_URL,
'Address ' AS Text,
a.Forename, a.Surname
FROM module_address AS d
LEFT JOIN admin AS a ON d.AdminID = a.ID
ORDER BY d.Updated DESC)
UNION
(SELECT d.ID, d.Created, d.Updated AS Updated,
'/modules/contact/ ' AS Link,
'Module ' AS Type,
'Contact ' AS Page_URL,
'Contact ' AS Section_URL,
'Contact ' AS Category_URL,
'Contact ' AS Text,
a.Forename, a.Surname
FROM module_contact AS d
LEFT JOIN admin AS a ON d.AdminID = a.ID
ORDER BY d.Updated DESC)
UNION
(SELECT d.ID, d.Created, d.Updated AS Updated,
'/modules/sidebar/ ' AS Link,
'Module ' AS Type,
'Sidebar ' AS Page_URL,
'Sidebar ' AS Section_URL,
'Sidebar ' AS Category_URL,
'Sidebar ' AS Text,
a.Forename, a.Surname
FROM module_sidebar AS d
LEFT JOIN admin AS a ON d.AdminID = a.ID
ORDER BY d.Updated DESC)
UNION
(SELECT d.ID, d.Created, d.Updated AS Updated,
'/modules/news/ ' AS Link,
'News ' AS Type,
'NULL ' AS Category_URL,
p.TabURL AS Section_URL,
d.Title AS Text,
d.TabURL AS Page_URL,
a.Forename, a.Surname
FROM news_details AS d
LEFT JOIN admin AS a ON d.AdminID = a.ID
LEFT JOIN pages AS p ON p.Type = 'news'
ORDER BY d.Updated DESC)
UNION
(SELECT d.ID, d.Created, d.Updated AS Updated,
'/manage/ ' AS Link,
'Page ' AS Type,
'NULL ' AS Section_URL,
'NULL ' AS Category_URL,
d.TabName AS Text,
d.TabURL AS Page_URL,
a.Forename, a.Surname
FROM pages AS d
LEFT JOIN admin AS a ON d.AdminID = a.ID
ORDER BY d.Updated DESC)
ORDER BY Updated DESC
LIMIT 0,10";