Crystalboy1
Programmer
hello All!
i have written a stored Procedure, i got 7 breakdown Options. for Example
A, B, C, D, E, F, G,
Now let say i got a table having calulted data in fields
tablename
(A,
b,
c,
d,
e,
f,
g,
CalulatedAccounts,
CalcultedSum,
TotalProfit)
now let say i am returing my data
************************************************
Example No 1
Now if i have selected A,D,G and the reset of paramenters that is B,C,E,F are NULL then i would return
Select
A,
D,
G,
SUM (CalulatedAccounts),
Sum (CalcultedSum),
Sum(TotalProfit)
from TableName
Group by
A,
D,
G
***********************************************
************************************************
Example No 2
Now if i have selected D,E,F and the reset of paramenters that is A,B,C,G are NULL then i would return
Select
D,
E,
F,
SUM (CalulatedAccounts),
Sum (CalcultedSum),
Sum(TotalProfit)
from TableName
Group by
D,
E,
F
***********************************************
************************************************
Example No 3
Now if i have selected A and the reset of paramenters that is B,C,D,E,F,G are NULL then i would return
Select
A,
SUM (CalulatedAccounts),
Sum (CalcultedSum),
Sum(TotalProfit)
from TableName
Group by
A
***********************************************
Inshort whatever parameters i select, i want to group by them.. and ignore the rest....
if i do that by
i need logic for dynamic SQL becuase if i do the normal repetative statments and do check for every columns i think its more then 60 combinations which will kill me...
i have written a stored Procedure, i got 7 breakdown Options. for Example
A, B, C, D, E, F, G,
Now let say i got a table having calulted data in fields
tablename
(A,
b,
c,
d,
e,
f,
g,
CalulatedAccounts,
CalcultedSum,
TotalProfit)
now let say i am returing my data
************************************************
Example No 1
Now if i have selected A,D,G and the reset of paramenters that is B,C,E,F are NULL then i would return
Select
A,
D,
G,
SUM (CalulatedAccounts),
Sum (CalcultedSum),
Sum(TotalProfit)
from TableName
Group by
A,
D,
G
***********************************************
************************************************
Example No 2
Now if i have selected D,E,F and the reset of paramenters that is A,B,C,G are NULL then i would return
Select
D,
E,
F,
SUM (CalulatedAccounts),
Sum (CalcultedSum),
Sum(TotalProfit)
from TableName
Group by
D,
E,
F
***********************************************
************************************************
Example No 3
Now if i have selected A and the reset of paramenters that is B,C,D,E,F,G are NULL then i would return
Select
A,
SUM (CalulatedAccounts),
Sum (CalcultedSum),
Sum(TotalProfit)
from TableName
Group by
A
***********************************************
Inshort whatever parameters i select, i want to group by them.. and ignore the rest....
if i do that by
i need logic for dynamic SQL becuase if i do the normal repetative statments and do check for every columns i think its more then 60 combinations which will kill me...