Problem With Matrix (in Subreport, Multiple Groups), Groups Repeating First Row Data
Jan 25, 2008
I have a new SQL 2005 (SP2) Reporting Services server to which I've just upgraded and deployed some SSRS 2000 reports.
I have a subreport that contains a matrix with two groups. The report data seems to be inexplicably repeating the data for the first row in the group for all rows in the group. Example:
ID1
ID2
DisplayData
1
1
A
1
2
B
1
3
C
2
1
A
2
2
B
2
3
C
Parent group is on ID1, child group is on ID2, report would show:
1
1
A
2
A
3
A
2
1
A
2
A
3
A
Is this a matrix bug in 2005 SP2, or do I need to do something differently? I can no longer pull a comparison version from an SSRS 2000 server to verify, but I believe it was working as expected before...
View 2 Replies
ADVERTISEMENT
Jun 1, 2015
I have one matrix with multiple row & column groups which is not looking nice.
See the below image. The reason for having a Matrix is they can create any no of Tests.
In the above image i have two row groups Test Type and Test Date and column groups as TestDesc and my required format is .
View 2 Replies
View Related
Mar 3, 2008
I wirte my query as:
select mydate
from mytable
group by mydate
ordre by mydate
The datatype of mydate column is DateTime. The result is showing me same repeating groups e.g.
2/27/2008 12:00:00 AM
2/27/2008 12:00:00 AM
2/27/2008 12:00:00 AM
Please help so that my query can give me unique groups.
Regards,
Professor Corrie.
View 9 Replies
View Related
Jan 16, 2015
I have some data where a bit value changes over time and I want to rank it by the repeating groups, how do I write the SQL so that I get the result below?
I want to sort by create date, and every time the bit changes value we start the rank over.
If I partition by the bit field, it will just group the entire data set by the bit field.
Bit CreateDate Rank
1 3/15/2014 1
1 3/14/2014 2
0 3/9/2014 1
0 3/8/2014 2
0 3/6/2014 3
1 3/4/2014 1
0 2/28/2014 1
0 2/20/2014 2
0 2/15/2014 3
0 2/10/2014 4
View 3 Replies
View Related
Aug 3, 2007
Hi all.
I have what I thought would be a simple problem, maybe my approach is all wrong!
Say you have customers, registered in a year/month group. They can be active in another year/month group.
So we get a simple table with registration year/month down the side and activity along the top.
This shows "of all the people p who register in month m, how many are active in month a?"
So assuming that all people registered in month m are also active in month m, the max(activity) for that slice (ie the max value for any active month for the registered month) should be the value if we collapse the activemonth group to activeyear.
Let me try to draw it :D
Registered/Active
2006 2007 ...
Jan Feb Mar ... Jan Feb Mar ... ...
2 Jan 20 10 10 20 . 5 3 1 5 20
0 Feb 0 25 15 25 . 8 5 5 8 25
0 Mar 0 0 40 40 . 11 1 6 11 40
6 ... 20 35 65 65 . 24 9 12 24 85
2 Jan 0 0 0 0 . 50 34 44 34 50
0 Feb 0 0 0 0 . 0 45 40 41 45
7 ... 20 35 65 65 . 50 79 44 75 95
..... 20 35 65 65 . 74 88 56 99 180
I think. The ...'s represent the grouping band total.
View 1 Replies
View Related
May 8, 2007
Is there any way to give Title to matrix row and column groups?
I know If i have only one row i can give title in the textbox provided at the top of the Rows group area. But i have more than one row and group and more than one column group. i want to give title to all of them.
Without the title the report looks incomplete
Is there any solution for this problem?
Thanks
Rohit
View 1 Replies
View Related
Dec 17, 2007
Hi
I have a report that calculates shipping quantities based on customer orders, and color codes them based on whether or not we have stock for a full shipment (green), have partial stock for a shipment (blue), or if we have none (red). Every week we get customer orders and build accordingly.
I have this all worked out except for parts with multiple ship to locations. RS seems to parse the entire row of the first ShipTo, then the second ShipTo. I'm using the running total function to calculate if there is a need or not. Anybody have any ideas?
Here is an example of the output I am getting. On the 17th, the 360 should be in green not red. I double checked the grouping, and it is on part number. This is for a matrix.
http://img519.imageshack.us/img519/8650/productionqg0.png
View 1 Replies
View Related
Aug 21, 2007
I have a report thats fully functional. I just want to add a filter so that my "Visits" field only displays the Visits per day that are less then 6. When i try to filter out the matrix or the group, it tells me the datatypes are different . Something about int32. Its in a matrix, but i have seen this happen in a table too, so i guessing thats not the problem. I just want to be able to display the information for Sales Reps with less then 6 Visits. Any help, will be greatlly appreciated.
View 1 Replies
View Related
Jun 6, 2007
Please, i need a very urgent help, for this question... tkssss :-)
I need to create a report with dynamic columns. I try use Matrix, but in this time, i dont konw how to calcutate the subtotal e groups in the correct way.
The data for generate the report ( http://xs116.xs.to/xs116/07233/DataReport.JPG )
This is the actual report ( 2 rows groups and 1 columns group ) ok, but how group dates now ? ( http://xs116.xs.to/xs116/07233/ReportInvalid.JPG
The correct report i need( if is possible?) (http://xs116.xs.to/xs116/07233/ReportOK.JPG)
I need group by Filial (idFilial) Dates (Dta) and inside dates the Dispositivos(NomeDispositivo or IdDispositivo) of the date.... and finally total all by group Filial (idFilial)...
Code of my actual report....
Code Snippet
<?xml version="1.0" encoding="utf-8"?>
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
<DataSources>
<DataSource Name="INTEGRAReport">
<ConnectionProperties>
<ConnectString>server=111.11.1.111GPS;Integrated Security=False;User Id=integraapp;Password=asasasas;initial catalog=INTEGRA_DESENV;Persist Security Info=True;Connection Timeout=360</ConnectString>
<DataProvider>SQL</DataProvider>
</ConnectionProperties>
<rd:DataSourceID>637ed8b0-ea9b-4da1-b6b8-6710cf62db84</rd:DataSourceID>
</DataSource>
</DataSources>
<BottomMargin>1in</BottomMargin>
<RightMargin>1in</RightMargin>
<rd:DrawGrid>true</rd:DrawGrid>
<InteractiveWidth>8.5in</InteractiveWidth>
<rd:SnapToGrid>true</rd:SnapToGrid>
<Body>
<ReportItems>
<Matrix Name="matrix1">
<MatrixColumns>
<MatrixColumn>
<Width>1.25in</Width>
</MatrixColumn>
<MatrixColumn>
<Width>1.25in</Width>
</MatrixColumn>
</MatrixColumns>
<Left>0.125in</Left>
<RowGroupings>
<RowGrouping>
<Width>1.25in</Width>
<DynamicRows>
<ReportItems>
<Textbox Name="textbox6">
<rd:DefaultName>textbox6</rd:DefaultName>
<ZIndex>4</ZIndex>
<Style>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
<TextAlign>Center</TextAlign>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value>=Fields!NomeFilial.Value</Value>
</Textbox>
</ReportItems>
<Grouping Name="matrix1_GroupFilial">
<GroupExpressions>
<GroupExpression>=Fields!IdFilial.Value</GroupExpression>
</GroupExpressions>
</Grouping>
</DynamicRows>
</RowGrouping>
<RowGrouping>
<Width>1.25in</Width>
<DynamicRows>
<ReportItems>
<Textbox Name="textbox10">
<rd:DefaultName>textbox10</rd:DefaultName>
<ZIndex>3</ZIndex>
<Style>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
<TextAlign>Right</TextAlign>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value>=Fields!Dta.Value</Value>
</Textbox>
</ReportItems>
<Grouping Name="matrix1_RowGroup3">
<GroupExpressions>
<GroupExpression>=Fields!IdProduto.Value</GroupExpression>
<GroupExpression>=Fields!Dta.Value</GroupExpression>
</GroupExpressions>
</Grouping>
</DynamicRows>
</RowGrouping>
<RowGrouping>
<Width>1.25in</Width>
<StaticRows>
<StaticRow>
<ReportItems>
<Textbox Name="textbox11">
<rd:DefaultName>textbox11</rd:DefaultName>
<ZIndex>2</ZIndex>
<Style>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value>=Fields!NomeDipositivo.Value</Value>
</Textbox>
</ReportItems>
</StaticRow>
</StaticRows>
</RowGrouping>
</RowGroupings>
<ColumnGroupings>
<ColumnGrouping>
<DynamicColumns>
<ReportItems>
<Textbox Name="NomeProduto">
<rd:DefaultName>NomeProduto</rd:DefaultName>
<ZIndex>7</ZIndex>
<Style>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
<TextAlign>Center</TextAlign>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value>=Fields!NomeProduto.Value</Value>
</Textbox>
</ReportItems>
<Grouping Name="matrix1_NomeProduto">
<GroupExpressions>
<GroupExpression>=Fields!NomeProduto.Value</GroupExpression>
</GroupExpressions>
</Grouping>
</DynamicColumns>
<Height>0.375in</Height>
</ColumnGrouping>
<ColumnGrouping>
<Height>0.375in</Height>
<StaticColumns>
<StaticColumn>
<ReportItems>
<Textbox Name="textbox3">
<rd:DefaultName>textbox3</rd:DefaultName>
<ZIndex>6</ZIndex>
<Style>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
<TextAlign>Center</TextAlign>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value>Qtd</Value>
</Textbox>
</ReportItems>
</StaticColumn>
<StaticColumn>
<ReportItems>
<Textbox Name="textbox4">
<rd:DefaultName>textbox4</rd:DefaultName>
<ZIndex>5</ZIndex>
<Style>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
<TextAlign>Center</TextAlign>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value>Saldo</Value>
</Textbox>
</ReportItems>
</StaticColumn>
</StaticColumns>
</ColumnGrouping>
</ColumnGroupings>
<DataSetName>ConsolidadoEntregasDataSet_RelatorioConsolidadoEntregas</DataSetName>
<Width>6.25in</Width>
<Corner>
<ReportItems>
<Textbox Name="textbox1">
<rd:DefaultName>textbox1</rd:DefaultName>
<ZIndex>8</ZIndex>
<Style>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
<TextAlign>Center</TextAlign>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value>Filial
/
Dispositivo</Value>
</Textbox>
</ReportItems>
</Corner>
<Style>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
</Style>
<Height>1.125in</Height>
<MatrixRows>
<MatrixRow>
<Height>0.375in</Height>
<MatrixCells>
<MatrixCell>
<ReportItems>
<Textbox Name="Qtd">
<rd:DefaultName>Qtd</rd:DefaultName>
<ZIndex>1</ZIndex>
<Style>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
<TextAlign>Center</TextAlign>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value>=Fields!Qtd.Value</Value>
</Textbox>
</ReportItems>
</MatrixCell>
<MatrixCell>
<ReportItems>
<Textbox Name="textbox5">
<rd:DefaultName>textbox5</rd:DefaultName>
<Style>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
<TextAlign>Center</TextAlign>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value>=Fields!Saldo.Value</Value>
</Textbox>
</ReportItems>
</MatrixCell>
</MatrixCells>
</MatrixRow>
</MatrixRows>
</Matrix>
</ReportItems>
<Height>1.875in</Height>
</Body>
<PageHeader>
<Height>0.25in</Height>
<PrintOnLastPage>true</PrintOnLastPage>
<PrintOnFirstPage>true</PrintOnFirstPage>
</PageHeader>
<rd:ReportID>872304d3-bc47-4430-8d0b-ea8c9d927f42</rd:ReportID>
<LeftMargin>1in</LeftMargin>
<DataSets>
<DataSet Name="ConsolidadoEntregasDataSet_RelatorioConsolidadoEntregas">
<rd:DataSetInfo>
<rd:TableAdapterGetDataMethod>GetData</rd:TableAdapterGetDataMethod>
<rd:DataSetName>ConsolidadoEntregasDataSet</rd:DataSetName>
<rd:TableAdapterFillMethod>Fill</rd:TableAdapterFillMethod>
<rd:TableAdapterName>RelatorioConsolidadoEntregasTableAdapter</rd:TableAdapterName>
<rd:TableName>RelatorioConsolidadoEntregas</rd:TableName>
</rd:DataSetInfo>
<Query>
<rd:UseGenericDesigner>true</rd:UseGenericDesigner>
<CommandType>StoredProcedure</CommandType>
<CommandText>dbo.RelatorioConsolidadoEntregas</CommandText>
<DataSourceName>INTEGRAReport</DataSourceName>
</Query>
<Fields>
<Field Name="IdFilial">
<rd:TypeName>System.Int32</rd:TypeName>
<DataField>IdFilial</DataField>
</Field>
<Field Name="IdProduto">
<rd:TypeName>System.Int32</rd:TypeName>
<DataField>IdProduto</DataField>
</Field>
<Field Name="NomeProduto">
<rd:TypeName>System.String</rd:TypeName>
<DataField>NomeProduto</DataField>
</Field>
<Field Name="NomeFilial">
<rd:TypeName>System.String</rd:TypeName>
<DataField>NomeFilial</DataField>
</Field>
<Field Name="NomeDipositivo">
<rd:TypeName>System.String</rd:TypeName>
<DataField>NomeDipositivo</DataField>
</Field>
<Field Name="Dta">
<rd:TypeName>System.String</rd:TypeName>
<DataField>Dta</DataField>
</Field>
<Field Name="Qtd">
<rd:TypeName>System.Int32</rd:TypeName>
<DataField>Qtd</DataField>
</Field>
<Field Name="Saldo">
<rd:TypeName>System.Int32</rd:TypeName>
<DataField>Saldo</DataField>
</Field>
<Field Name="IdDispositivo">
<rd:TypeName>System.Int32</rd:TypeName>
<DataField>IdDispositivo</DataField>
</Field>
</Fields>
</DataSet>
</DataSets>
<Width>11.875in</Width>
<InteractiveHeight>11in</InteractiveHeight>
<Language>en-US</Language>
<TopMargin>1in</TopMargin>
</Report>
View 3 Replies
View Related
Jan 2, 2007
Can we do this?
Adding more columns in a matrix report that don€™t
belong to the columns drilldown dimensions€¦
That is, for example, having the following report:
Product Family
Product
Country City Number of units sold
Then I
would add some ratios, that is, Units Sold/Months (sold per month) and other that
is the average for Product Family (Units Sold/Number of Product Family), for putting an example€¦ some
columns should be precalculated prior to the report so do not get into it, the
real problem I don€™t see how to solve is adding one or two columns for showing
these calculated column that doesn€™t depend on the column groups but they do
for the rows groups€¦
Any guidance
on that?
The only
way I am seeing by now is to set it as two different reports, and that is not
what my client wants€¦
Many
thanks,
Jose
View 4 Replies
View Related
Aug 17, 2015
I am in the process of creating a Report, and in this, i need ONLY the row groups (Parents and Child).I have a Parent group field called "Dept", and its corresponding field is MacID.I cannot create a child group or Column group (because that's not what i want).I am then inserting rows below MacID, and then i toggle the other rows to MacID and MacID to Dept.
View 3 Replies
View Related
Dec 18, 2006
I have one of our production Accounting Databases starting from 2 GBnow grown into a 20 GB Database over the period of a few years...I have been getting timeouts when transactions are trying to updatedifferent tables in the database.. Most of the error I get are I/Orequests to the data file (Data file of the production dbAccounting_Data.MDF).I would like to implement the following to this Accounting database.I need to split the Data file into multiple files by placing some ofthe tables in different file groups. I have the server upgraded to beable to have different drives in different channels. I can place thesedata and log files in different drives so it will be less I/Oconflicts..I would like to have the following file groups..FileGroup 1 - which will have all database definitions (DDL).FileGroup 2 - I will have the AR Module tables under here..FileGroup 3 - I will have the GL module tables under here..FileGroup 4 - I will have the rest of the tables under hereFileGroup 5 - I will like to place the indexes under here....Also where will the associated transaction files go?I would like to get some help doing this. Is there any articles / helpavailable that I can refer to. Any suggestions / corrections/criticisms to what I have mentioned above is much appreciated...!Thanks in advance....
View 1 Replies
View Related
Dec 10, 1998
We are trying to setup security on our Sql Server. We are using Integrated
Security.
The problem we are having is that we need to have a user belong to multiple groups within one database. The user would have different rights depending upon which group they belonged to.
So far we have not found anyway to accomplish this setup.
I would appreciate any ideas/thoughts on this matter.
Thanks,
Tracy Young
View 1 Replies
View Related
Feb 19, 2013
I have a large table that tells me customers and mailings (~4 million rows). So for each customer, I see what mailing(s) they received. It is at the mailing level so if a customer received 2 mailings, their will be 2 records for that customer number, one for each mailing they received. There are 3 different mailings.I am trying to calculate the count of customers that received all 3, as well as those that received 1&2 only, 1&3 only, and 2&3 only. For example:
CustNo Mailing
Tim 1
Tim 3
Dan 1
Dan 3
Jane 1
Max 1
Max 2
Max 3
Lauren 2
Lauren 3
Results:
All 3 - 1
1&2 only - 0
1&3 only - 2
2&3 only - 1
I have tried doing some funky table joining and EXISTS, but the query runs and runs because of how much data it has to sift through. Here is the code I am using to find Mailing 1&2 only customers, but I am not even sure it is getting me the right numbers. There are 2 different types of customers as well which is why I have custtype in there.
Code:
select a.custtype,count(distinct a.custno)
from myTable a
inner join (select distinct custno from mytable where [mailing]=2) b
on a.custno=b.custno
where a.[mailing]=1
and not exists(select * from myTable c where a.custno=c.custno and c.[mailing]=3)
group by a.custtype
View 14 Replies
View Related
Aug 12, 2013
From what I understand, one SQL Server 2012 instance can host multiple availability groups. That should allow, for example, the following situation - one SQL Server 2012 instance containing three primary replica databases - each one part of a different availability group - and each availability group's secondary replica located on a separate SQL Server 2012 instance.
Can you have three SQL Server 2012 instances, each with one primary replica database and have all three secondary replica databases on one SQL Server 2012 instance? So instead of, as above, going from 1 primary server to 3 secondary servers, this time we're going from 3 primary servers to 1 secondary server? The one secondary server would then contain all three secondary replicas for each of the 3 separate primary replicas.
This would mean that the single server (where all three secondary replicas reside) was part of three separate Windows Server Failover Clustering clusters.
Is this scenario possible?
View 4 Replies
View Related
Jun 10, 1999
I have multiple security groups for which I would like to print off the
different table rights associated. Is there a quick and easy way to
accomplish this? Thanks, Craig.
View 1 Replies
View Related
Oct 9, 2007
I am working on conversion of Crystal reports to SSRS. The existing report has two level of grouping. So I have included 2 list inside a third list and then done the grouping. Is there another way to do multiple grouping ? Every thing is working fine except for getting one extra blank page at the end of report with only header and footer. I have properly checked the body height and width and page margins. It has something to do with list but i cant figure out what.
View 1 Replies
View Related
Dec 3, 2007
Hi,
I have a matrix which displays like this
Title1 A Book
Another Book
Title2 Yet another book
My Book
How can I display it like this:
Title1 A Book
Title1 Another Book
Title2 Yet another book
Title2 My Book
So that when I export this to excel I can sort and filter data easier. Thanks very much.
View 4 Replies
View Related
May 21, 2015
I have a CTE returning a recordset which contains a column SRC. SRC is a number which I use later to get counts and sums for the records in a distinct list.Â
declare@startdate date = '2014-04-01'
declare@enddate date = '2014-05-01'
; with SM as
(
SELECT --ROW_NUMBER() OVER (PARTITION BY u.SRC ORDER BY u.SRC) As Row,
u.SRC,
[Code] ....
-- If Referral start date is between our requested dates
ref.Referral_Start_Date between @startdate and @enddate
OR
-- Include referrals which started before our requested date, but are still active during our date range.
(ref.Referral_Start_Date < @startdate and (ref.Referral_End_Date > @startdate OR ref.Referral_End_Date IS NULL ))
)
INNER JOIN c_sdt s on s.Service_Delivery_Type_Id = u.Service_Delivery_Type_Id
AND s.Service_Delivery_Unit_Id = 200
)
SELECT
count(distinct (case SRC when 91 then client_number else 0 end)) As Eligable_91,
[code]....
View 5 Replies
View Related
Jun 15, 2015
I need to calculate the last two columns (noofgrp and grpsize) No of Groups (count of Clientid) and Group Size (number of clients in each group) according to begtim and endtime. So I tried the following in the first Temp table
GrpSize= count(clientid) over (partition by begtime,endtime) else 0 end
and in the second Temp Table, I have
select
,GrpSize=sum(grpsize)
,NoofGrp=count(distinct grpsize)
From Temp1
The issue is for the date of 5/26, the begtime and endtime are not consistent. in Grp1 (group 1) all clients starts the session at 1030 and ends at 1200 (90 minutes session) except one who starts at 11 and end at 1200 (row 8). For this client since his/her endtime is the same as others, I want that client to be in the first group(Grp1). Reverse is true for the second group (Grp2). All clients begtime is 12:30 and endtime is 1400 but clientid=2 (row 9) who begtime =1230 but endtime = 1300. However, since this client begtime is the same as the rest, I wan that client to be in the second group (grp2) My partition over creates 4 groups rather than two.
View 9 Replies
View Related
Mar 26, 2015
I'm trying to generate a single record that shows the status of an accounting period for multiple groups. For a single accounting period they could all be the same, or all be different (open, closed, hold, etc)
What I want to do is select the accounting period with a group by that says if all the groups are in the same status, then that's the status. But if there are different status' for the period, I just want to have a single line that says 'Mixed' The query below returns 3 records, but I only want 2. I tried a CASE WHEN Having COUNT > 1 but it blew up with an aggregate subquery in a group by error.
DECLARE @AccountingPeriod Table
(AccountingPeriod varchar(10), Status char(1), GroupNum int)
Insert into @AccountingPeriod
Values('2015-03','O',1),
('2015-03','O',2),
('2015-03','O',3),
('2015-02','O',1),
('2015-02','O',2),
('2015-02','C',3)
Select AccountingPeriod, Status from @AccountingPeriod
GROUP BY AccountingPeriod, Status
View 3 Replies
View Related
Nov 10, 2015
I have a Cost table with the following field:
Year, Quarter, Cost1, Cost2
I would like to write a SQL so that it will give me something like that, so that I will have 2 years across the top with the same same columns.
2016Â
Â
2015
Quarter
Cost1
Cost2
Â
Cost1
Cost2
1
100
200
[code]....
View 3 Replies
View Related
May 8, 2007
Hello everybody,
I have a matric that looks like this :
SALES RETURNS
Client1 100 50
Client2 40 0
But when there is no returns in the month, the column returns isn't displayed. So I get this:
SALES
Client1 100
Client2 40
How can I show this column even with empty data?
Thanks in advance for your help.
Zoz
View 5 Replies
View Related
Nov 4, 2007
I am new to this forum so I am not sure if this is posted in the appropriate group.
Okay - this may be a silly question - what is a crosslink table? Is this easily achieved in the MySQL query browser? Here is some more details on what I am trying to achieve. I have seen it done but not sure where to start....
The products correspond as follows:
- To be eligible for 'product a' the buyer must meet two qualifications:
1. Specify their 'model of their engine.'
2. Specify the 'year' of their engine.
Is there a way to structure my tables so that if a person specifies 'a specific year' and 'specific model' the correct product A, B, or C will pull up for them?
Do I create separate tables named 'Engine Model' and 'Engine Year' -- and then link to the product table with foreign keys? If so, how do I specify more than one grouping. For example product A is compatible with 2004-2007 engines and 10 different engine models.
I am new to mySql -- but a quick study -- hopefully this is easy to implement.
thanks.
View 2 Replies
View Related
Apr 28, 2014
I am looking for the easiest way of rebalancing data across multiple files.
Instead of creating a secondary filegroup and then dropping and recreating all indexes in the database which is going to take ages (we have a lot of tables and indexes), I am trying to just add more files to the primary file group and then rebalance data evenly between these.
I guessed that adding the new files to the primary file group and then rebuilding all indexes on a table should redistribute the table over these multiple file groups evenly. This is not the case though. It does rebalance data a bit but I still end up with the majority on the first file that existed.
I have attached the script I am running, maybe it is something in the create database/file statements that is the issue.
Basically what I am seeing is to start off with the table is 160MB. I then add the file groups and rebuild all indexes on the table. The first file is then about 100MB and each of the three other files are about 20MB. I would expect them all to be the same size.
View 4 Replies
View Related
Jun 5, 2014
I have a two node SQL 2012 AlwaysOn HADR cluster (v11.0.3412) with 4 availability groups configured. The AG groups are set to synchronous mode and the secondary is not readable (we do not want the synchronous replica readable so we do not risk any reads causing contention so we maintain fast performance).
On the secondary we are getting a persistent failure with the Data Collector job called Collection_Set_3_Upload. The failure occurs within the second job step. That job step is executing the following command:
dcexec -u -s 3 -i "$(ESCAPE_DQUOTE(MACH))$(ESCAPE_DQUOTE(INST))"
The error message is as follows:
Log Job History (collection_set_3_upload) Step ID 2 Server CLUSTERNODE2
Job Name collection_set_3_upload
Step Name collection_set_3_upload_upload
Duration 00:00:07
[Code] ....
I know I can prevent this error message by enabling readable secondaries, but we do not want this.
I have tried stopping the data collection jobs and purging the cache directory but to no avail. It will succeed the first time then persistently fail again with the same message every time after that.
In addition, if I set the one failing AG group to readable secondary the job succeeds. So that means that 3/4 work fine, only this one is having an issue.
View 0 Replies
View Related
Mar 13, 2008
Ok so facebook groups have 100,000's of members. Members can be part of an unlimited number of groups, and a group can have an unlimited number of members.
Comma Deliniated String seems absurd. Many-2-Many Database relationship seems like it won't scale well t the 10's of thousands and 100's of thousands of members (especially if you have 1000-5000 groups). A table for each group would work but thats a bit over the top in my opinion. XML file doesn't seem to be any better than the above options.
I am no database guru, but I can't figure out a scalable method of doing this, be it with or without a database. I need something that can support 10 groups that have 20 members each OR 1000 groups with 100,000 members each.
Any help, suggestions, or kicked in the right direction would be most appreciated.
View 3 Replies
View Related
Aug 11, 2014
i've been looking at moving one of our processed from excel (+vba) into t-sql to make life easier but am stuck.
We have lots of tasks that are assigned to work groups which we want to distribute evenly across the work groups. This is a simple task for ntile.. However when these tasks are no longer required they are removed which leaves the groups uneven. When new tasks are added we want to still try to keep these groups balanced.
EG Existing groups :
GroupName - Task Count
Group1 - 1000
Group2 - 999
Group3 - 998
If we were to add 6 new tasks they would have more assigned to Group 2 & 3 as they have less than group 1.
Task 1 - Group3
Task 2 - Group3
Task 3 -Group2
Task 4 - Group1
Task 5 - Group2
Task 6 - Group3
Sample tables
Create table GroupTable
(GroupID int, Name varchar(200) )
Insert into GroupTable values (1,'Group1')
Insert into GroupTable values (2,'Group2')
Insert into GroupTable values (3,'Group3')
Create table Jobs(jobid int identity(1,1), name varchar(100),Groupid int)
--Existing tasks
Insert into Jobs(name,Groupid) values ('Task1',1)
Insert into Jobs(name,Groupid) values ('Task2',1)
Insert into Jobs(name,Groupid) values ('Task3',1)
Insert into Jobs(name,Groupid) values ('Task4',1)
Insert into Jobs(name,Groupid) values ('Task5',2)
Insert into Jobs(name,Groupid) values ('Task6',2)
Insert into Jobs(name,Groupid) values ('Task6',2)
Insert into Jobs(name,Groupid) values ('Task7',3)
-- New tasks
Insert into Jobs(name) values ('TaskA')
Insert into Jobs(name) values ('TaskB')
Insert into Jobs(name) values ('TaskC')
Insert into Jobs(name) values ('TaskD')
Insert into Jobs(name) values ('TaskE')
Insert into Jobs(name) values ('TaskF')
This gives us 6 unassigned tasks and a uneven group assignment
GROUPNAME TASK_COUNT
<none> 6
Group1 4
Group2 3
Group3 2
This means the new tasks will be assigned like this
TaskA - Group3
TaskB - Group3
TaskC - Group2
TaskD - Group1
TaskE - Group2
TaskF - Group3
View 5 Replies
View Related
Aug 21, 2014
OK, so I have:
- 500 GB DW
- 5 GB in smaller DBs
- 220 GB TempDB
- 350 GB in Log files.
My machine is Fujitsu Primergy 64 cores (with HT) and 192 GB RAM.
I have several IO locations:
- 540 GB in-server HDD 15k RAID10
- 1 TB HDD 15k RAID10 on SAN (separete controller)
- 2 TB HDD 15k RAID10 on SAN (same controlller as below)
- 800GB SSD RAID10 on SAN (same controller as above)
Data warehouse has 2 fact tables that are absolutely crucial and quite large.
Now i want to organize DB into several Filegroups and put them on different drives. Filegroups I'm thinking of:
- FILEGROUP1: for 1st crucial Fact Table
- FILEGROUP2: for 2nd crucial Fact Table
- FILEGROUP3: for tempDB
- FILEGROUP4: for dimensions data
- FILEGROUP5: for the rest of facts data
- FILEGROUP6: for dimensions indexes
- FILEGROUP7: for the rest of facts indexes
- FILEGROUP8: for 1 log file of one smaller DB (its in full-recovery and its quite large)
- FILEGROUP9: for the rest of log files
- FILEGROUP10: others
How should I organize them across available drives? I was thinking about sth like:
800 GB SSD: FILEGROUPS 1-3
2 TB RAID10: FILEGROUPS 5+7+8
1 TB RAID10: FILEGROUPS 4+6+10
540 GB in-server: FILEGROUP 9
I know that having multiple filegroups on the same drive is pointless regarding performance, but in future i could actually add some more drives, so i want to separate them now.
Also - how much files per filegroups should i create? Considering 1 or 2. Except TempDB where I am going for 4.
View 2 Replies
View Related
Nov 2, 2007
Greetings:
I am trying to gather into a central location the missing index data from the sys DMV's for dynamic index creation in the next step. In trying to use a cursor, I get the following errors:
Msg 154, Level 15, State 3, Line 20
variable assignment is not allowed in a cursor declaration.
Msg 102, Level 15, State 1, Line 94
Incorrect syntax near 'Get_Data'.
Msg 16916, Level 16, State 1, Line 2
A cursor with the name 'Get_Server' does not exist.
Msg 16916, Level 16, State 1, Line 3
A cursor with the name 'Get_Server' does not exist.
Here is the SQL:
--CREATE PROCEDURE usp_Get_Missing_Index_Data
--AS
--Declare @Sql2 nvarchar(4000)
Declare @Sql nvarchar(4000)
DECLARE Get_Server Cursor -- gets a server name from a list of servers
for
Select MachineName from rsqlaudit1.DBStatistics.dbo.servers
Open Get_Server
Declare @Server nchar(20)
Fetch Next from Get_Server Into
@Server
While (@@FETCH_STATUS = 0) --and (@@FETCH_STATUS <> -2)
BEGIN
DECLARE Get_Data Cursor
FOR
select @sql= 'select distinct id.*
, gs.avg_total_user_cost
, gs.avg_user_impact
, gs.last_user_seek
,gs.unique_compiles
from '+@Server+'.master.sys.dm_db_missing_index_group_stats gs
,'+@Server+'.master.sys.dm_db_missing_index_groups g
,'+@Server+'.master.sys.dm_db_missing_index_details id
where gs.group_handle = g.index_group_handle
and id.index_handle = g.index_handle
order by gs.avg_user_impact desc'
exec (@Sql)
Open Get_Data
DECLARE @Handle int,
@database smallint,
@object int,
@equality nvarchar(4000),
@inequality nvarchar(4000),
@Included nvarchar(4000),
@statement nvarchar(4000),
@avg_user_cost float,
@avg_user_impact float,
@last_seek datetime,
@compiles bigint
Fetch NEXT FROM Get_Data INTO
@Handle,
@database,
@object,
@equality,
@inequality,
@Included,
@statement,
@avg_user_cost,
@avg_user_impact,
@last_seek,
@compiles
While (@@FETCH_STATUS = 0) --and (@@FETCH_STATUS <> -2)
BEGIN
insert into rsqlaudit1.DBStatistics.dbo.Missing_Index_data
values (@Server,
@Handle,
@database,
@object,
@equality,
@inequality,
@Included,
@statement,
@avg_user_cost,
@avg_user_impact,
@last_seek,
@compiles)
FETCH NEXT FROM Get_Data into
@Server,
@Handle,
@database,
@object,
@equality,
@inequality,
@Included,
@statement,
@avg_user_cost,
@avg_user_impact,
@last_seek,
@compiles
Fetch Next from Get_Server Into
@Server
END
CLOSE Get_Data
DEALLOCATE Get_Data
GO
CLOSE Get_Server
DEALLOCATE Get_Server
GO
Any suggestions are appreciated.
Thanks,
Derek
View 3 Replies
View Related
Jun 13, 2007
Hello there,
I've got a simple report. In the header of the report I have some Informations and I want them to repeat.
In the ReportBody I have a matrix with a lot of colums - so the expand horizontically.
The rows of the matrix fit on one page, they dont cause a page break.
The Problem is, the report doesnt repeat the headers.
I tried to solve this :
putting the matrix in a rectangle
putting the rectangle in a table
using the table header for repetition
The problem now is, the free space between the outer side of the matrix an the right side of the rectangle (report is in landscape format) causes every second page an empty page.
What should I do???
Thanks for every idea. Tobi
View 4 Replies
View Related
Jan 30, 2007
Is it possible to repeat the row labels for matrix reports where there are multiple groups. So if the matrix report rows are department,division,employee then have all three labels show up on each row not just at the breaks. Cannot seem to find a way to do this. thanks
View 1 Replies
View Related
Jan 8, 2007
I expect to get a record below with a count of 0 (and I do), but when I take the comments out (--) of lines 1 & 6 I don't understand why I get no records at all. I need to be able to see all teams in EvalAnswers even if none of the records satisfies the where clause.1 select Count(*) as cnt--, TeamID
2 from EvalAnswers
3 where CoID=@CoID
4 and EvaluatorID=@EvaluatorID
5 and (Scr0=0 and Sugg0 is NULL)
6 --group by TeamID
7
View 4 Replies
View Related