Click to See Complete Forum and Search --> : Advanced stored procedure


webressurs
06-29-2007, 07:41 AM
Hi :)
I got a view that returns article information. One article har one or many article attributes, this is why my view return one or many records like this:

select * from myView

The View return 2 articles:
ID Publish start ArticleName TemplateID TemplateName AttributeName AttributeValue
4 22.05.2007 Article 1 1 Article Title Welcome
4 22.05.2007 Article 1 1 Article Ingress Hello
4 22.05.2007 Article 1 1 Article Body Cool
4 22.05.2007 Article 1 1 Article Info Yeah..
5 26.06.2007 Article 2 1 Article Title ByeBye
5 26.06.2007 Article 2 1 Article Ingress Ughhh
5 26.06.2007 Article 2 1 Article Body Nice
5 26.06.2007 Article 2 1 Article Info Arrrg

As you see it return 4 rows per article. This is because the Article template has 4 templateDefinitions. Another template can have more or less templatedefinitions. Is it possible to make a query based on this View that return 1 record for each article? Then each AttributeName shall be a column name, and the attributeValue shall be the value for this Column.

This is really hard to make, ugh!!!

bubbisthedog
06-29-2007, 09:04 AM
I, for one, am a little confused.

a) Consider putting your results within [ code ] [ /code ] tags from now on, and separate them with '|' or something so that the data is more readable.

b) You say that the reason that 4 records per article ('ArticleName,' I'm assuming) are returned because the 'Article' template has 4 'templateDefinitions,' yet 'templateDefinitions' are not defined explicitly. Is a 'templateDefinition' the same thing as your 'AttributeNames?'

c) May I ask for what reason you're wanting these 'AttributeNames' in separate columns? What you're asking is doable, but may be a bit convoluted. If we can figure out your motive here, perhaps we can devise a different and better solution.