How to sql query to return property data of the published version?
I am trying to write a query to get all property data of a published content version, so I am trying this first:
SELECT cd.*, cd.[text], cv.id, cv.VersionDate
FROM cmsDocument as cd
inner join cmsContentVersion as cv on cd.versionId = cv.VersionId
WHERE
cv.ContentId = 12270 and cd.newest = 1 and cd.published = 1
and it returns one record of the published version correctly.
Then I am extending it like this:
SELECT pd.id, pt.alias, cd.*, cd.[text], cv.id, cv.VersionDate
FROM cmsDocument as cd
inner join cmsContentVersion as cv on cd.versionId = cv.VersionId
inner join cmsPropertyData as pd **on pd.contentNodeId = cd.nodeId**
inner join cmsPropertyType as pt on pd.propertyTypeiD = pt.id
WHERE
cv.ContentId = 12270 and cd.newest = 1 and cd.published = 1
and it returns the correct document but all the properties are multiplied (different number of times, depending on the property), plus it returns also properties that already have been deleted and are not present in the published version.
This does not return anything
SELECT pd.id, pt.alias, cd.*, cd.[text], cv.id, cv.VersionDate
FROM cmsDocument as cd
inner join cmsContentVersion as cv on cd.versionId = cv.VersionId
inner join cmsPropertyData as pd **on cd.versionId = pd.versionId**
inner join cmsPropertyType as pt on pd.propertyTypeiD = pt.id
WHERE
cv.ContentId = 12270 and cd.newest = 1 and cd.published = 1
and it seems that versionId of a document is something else than the versionId of the property data.
How to write the correct query that returns the property of of the currently published content?
Highly recommend to use the api rather than a direct DB interaction.
Any direct DB interaction is going to be problematic and make maintaining a site, quite simply, a nightmare.
whatever you're doing is wrong.
you've been informed a number of times in the forums that direct SQL access is not a good idea.
please be respectful of other people's time, experience and knowledge.
How to sql query to return property data of the published version?
I am trying to write a query to get all property data of a published content version, so I am trying this first:
and it returns one record of the published version correctly.
Then I am extending it like this:
and it returns the correct document but all the properties are multiplied (different number of times, depending on the property), plus it returns also properties that already have been deleted and are not present in the published version.
This does not return anything
and it seems that versionId of a document is something else than the versionId of the property data.
How to write the correct query that returns the property of of the currently published content?
Highly recommend to use the api rather than a direct DB interaction. Any direct DB interaction is going to be problematic and make maintaining a site, quite simply, a nightmare.
You are wrongly assuming I want to use it in the backend. Please stick to answering the question.
whatever you're doing is wrong. you've been informed a number of times in the forums that direct SQL access is not a good idea. please be respectful of other people's time, experience and knowledge.
I ask you the same.
You have no idea what I am doing so assuming anything is simply blind. Your advice do not help anything. It is the waste of your and my time.
is working on a reply...