Multi-select CDFs: Difference between revisions

From IMSMA Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{{Warning | This page contains UPDATE syntax }}
{{Warning | This page contains UPDATE syntax }}
[[Image:CDF used twice.png|250px|center]]
If the result set contains '''other''' values than NULL and 0, you need to carefully analyse why because that is an indication that it could be templates where the same CDF has been entered more than once.
<pre>
SELECT
cdfvalue.`position`,
Count(cdfvalue.cdfvalue_guid)
FROM
cdfvalue
GROUP BY
cdfvalue.`position`
</pre>
[[Image:CDF used twice2.png|500px|center]]
This query will show if the same CDF is used more than once.
<pre>
SELECT
cdfvalue.position,
cdfvalue.cdf_id,
Count(cdfvalue.cdfvalue_guid)
FROM
cdfvalue
GROUP BY
cdfvalue.`position`,
cdfvalue.cdf_id
order by
cdfvalue.cdf_id,
cdfvalue.`position`
</pre>
This query can be run in mySQL (5.08.04) or in Postgres (6.0). It is recommended to run it on 5.08.04 as part of the pre-checks and updates.
<pre>
<pre>
UPDATE cdfvalue
UPDATE cdfvalue
Line 5: Line 36:
where position is NULL
where position is NULL
</pre>
</pre>
This query can be run in mySQL (5.08.04) or in Postgres (6.0). It is recommended to run it on 5.08.04 as part of the pre-checks and updates.
{{NavBox Upgrade}}
{{NavBox Upgrade}}
[[Category:NoPublic]]
[[Category:NoPublic]]
[[Category:SQL Queries]]
[[Category:SQL Queries]]

Latest revision as of 21:47, 10 September 2015

This page contains UPDATE syntax

If the result set contains other values than NULL and 0, you need to carefully analyse why because that is an indication that it could be templates where the same CDF has been entered more than once.

SELECT
cdfvalue.`position`,
Count(cdfvalue.cdfvalue_guid)
FROM
cdfvalue
GROUP BY
cdfvalue.`position`

This query will show if the same CDF is used more than once.

SELECT
cdfvalue.position,
cdfvalue.cdf_id,
Count(cdfvalue.cdfvalue_guid)
FROM
cdfvalue
GROUP BY
cdfvalue.`position`,
cdfvalue.cdf_id
order by 
cdfvalue.cdf_id,
cdfvalue.`position`

This query can be run in mySQL (5.08.04) or in Postgres (6.0). It is recommended to run it on 5.08.04 as part of the pre-checks and updates.

UPDATE cdfvalue
SET position = 0
where position is NULL

{{#switch:|subgroup|child=|none=|#default=

}}{{#if:|}}{{#if:Upgrade Process|<td style="text-align:left;border-left-width:2px;border-left-style:solid;|{{#if:|}}}}{{#if:|{{#if:IMSMA Hub{{#switch:{{#if:|{{{border}}}|child}}|subgroup|child=|none=|#default=

}}{{#ifeq:|Template|{{#ifeq:{{#if:|{{{border}}}|child}}|child||{{#ifeq:{{#if:|{{{border}}}|child}}|subgroup||{{#switch:multi-select cdfs

|doc
|sandbox
|testcases =
|#default = {{#switch:
 |plainlist
 |hlist
 |hlist hnum
 |hlist vcard
 |vcard hlist = 
 |#default = 
 }}
}}

}}}}}}|}}{{#if:|{{{group2}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list2}}}

}}{{#if:|{{#if:IMSMA Hub{{#switch:{{#if:|{{{border}}}|child}}|subgroup|child=|none=|#default=

}}{{#ifeq:|Template|{{#ifeq:{{#if:|{{{border}}}|child}}|child||{{#ifeq:{{#if:|{{{border}}}|child}}|subgroup||{{#switch:multi-select cdfs

|doc
|sandbox
|testcases =
|#default = {{#switch:
 |plainlist
 |hlist
 |hlist hnum
 |hlist vcard
 |vcard hlist = 
 |#default = 
 }}
}}

}}}}}}|}}{{#if:|{{{group3}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list3}}}

}}{{#if:|{{#if:|{{{group4}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list4}}}

}}{{#if:|{{#if:|{{{group5}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list5}}}

}}{{#if:|{{#if:|{{{group6}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list6}}}

}}{{#if:|{{#if:|{{{group7}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list7}}}

}}{{#if:|{{#if:|{{{group8}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list8}}}

}}{{#if:|{{#if:|{{{group9}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list9}}}

}}{{#if:|{{#if:|{{{group10}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list10}}}

}}{{#if:|{{#if:|{{{group11}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list11}}}

}}{{#if:|{{#if:|{{{group12}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list12}}}

}}{{#if:|{{#if:|{{{group13}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list13}}}

}}{{#if:|{{#if:|{{{group14}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list14}}}

}}{{#if:|{{#if:|{{{group15}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list15}}}

}}{{#if:|{{#if:|{{{group16}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list16}}}

}}{{#if:|{{#if:|{{{group17}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list17}}}

}}{{#if:|{{#if:|{{{group18}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list18}}}

}}{{#if:|{{#if:|{{{group19}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list19}}}

}}{{#if:|{{#if:|{{{group20}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list20}}}

}}{{#if:|{{#if:IMSMA Hub{{#switch:{{#if:|{{{border}}}|child}}|subgroup|child=|none=|#default=

}}{{#ifeq:|Template|{{#ifeq:{{#if:|{{{border}}}|child}}|child||{{#ifeq:{{#if:|{{{border}}}|child}}|subgroup||{{#switch:multi-select cdfs

|doc
|sandbox
|testcases =
|#default = {{#switch:
 |plainlist
 |hlist
 |hlist hnum
 |hlist vcard
 |vcard hlist = 
 |#default = 
 }}
}}

}}}}}}|}}

{{{below}}}

}}{{#switch:|subgroup|child=

|none=|#default=}}{{#ifeq:|Template|{{#ifeq:|child||{{#ifeq:|subgroup||{{#switch:multi-select cdfs
|doc
|sandbox
|testcases =
|#default = {{#switch:hlist
 |plainlist
 |hlist
 |hlist hnum
 |hlist vcard
 |vcard hlist = 
 |#default = 
 }}
}}

}}}}}}