
-- Get currrent version of WebPage at path /
select wp.*,
ref.label,ref.description,ref.title,ref.img_id,ref.img_over_id,ref.img_alt 
from CONTENT_RESOURCE_MAP_V2 map
join CONTENT_RESOURCE_V2 res on map.resource_id=res.id
left join CONTENT_WEBPAGE_V2 wp on res.id=wp.id
join CONTENT_RESOURCE_REF_V2 ref on res.self_ref_id=ref.id
where res.current_version=true and path='/';

-- Get Current version of WebPages 
select wp.*,
ref.label,ref.description,ref.title,ref.img_id,ref.img_over_id,ref.img_alt ,
map.path
from CONTENT_RESOURCE_MAP_V2 map
join CONTENT_RESOURCE_V2 res on map.resource_id=res.id
left join CONTENT_WEBPAGE_V2 wp on res.id=wp.id
join CONTENT_RESOURCE_REF_V2 ref on res.self_ref_id=ref.id
where res.current_version;


SELECT * FROM
CONTENT_RESOURCE_LIST_ITEM_V2 item 
left join CONTENT_RESOURCE_REF_V2 ref on item.value_resource_ref_id=ref.id
left join CONTENT_RESOURCE_MAP_V2 map on map.resource_id =ref.resource_id

order by idx