Page 1 of 1

Expand * in pivot query

Posted: Tue 22 Apr 2014 03:36
by sebeto
Hi,

New user of SQLComplete, I'm testing it before trying to push it to my colleagues if it suits our needs (some of them currently using SQLPrompt).

Our data model requires a lot of pivoting, for example in the following query:

Code: Select all

select *
from
(
	select	c.SAMPLEID
			,c.NAME
			,c.VALUE
	from CORPSAMPLEASSAY as c
	where c.NAME in ('LOI_Total', 'MnO_Calc_pct', 'Tot_Chk')
) as t
pivot
(
	avg(VALUE)
	for NAME in (LOI_Total, MnO_Calc_pct, Tot_Chk)
) as pvt
Am I doing something wrong, or can't '*' be expanded properly in this kind of situation?

If I TAB after *, SQLComplete expands to what follows rather than the pivoted columns:

Code: Select all

select t.SAMPLEID,t.NAME,t.VALUE
It should be:

Code: Select all

select 	pvt.SAMPLEID, pvt.LOI_Total, pvt.MnO_Calc_pct, pvt.Tot_Chk
It's quite an issue as it renders the expanding useless as soon as I have pivots in my CTEs and so on.

Is there any plan to implement expanding for pivoted fields in a near future?

Re: Expand * in pivot query

Posted: Tue 22 Apr 2014 09:59
by alexa
This appears to be a new feature that we are planning to implement in one of the next versions of the product.

Re: Expand * in pivot query

Posted: Wed 23 Apr 2014 05:57
by sebeto
Great, thanks a lot for your reply Alexa, I'm looking forward to having this ability!

Re: Expand * in pivot query

Posted: Mon 24 Apr 2017 16:24
by alexa
We would like to let you know that we have released dbForge SQL Complete, v5.6 where the functionality you were referring to is supported https://www.devart.com/dbforge/sql/sqlc ... nload.html

Thank you for your help in improving dbForge SQL Complete.