Showing posts with label excel. Show all posts
Showing posts with label excel. Show all posts

Monday, March 26, 2012

Multi-select problem with Excel as front-end

Hello,

I am trying to find a solution to a very elusive problem.

I have reviewed carefully every aspects of my cube as well as my test case and made only little progress.

When using Excel to connect to an AS2005 SP2 cube, if I try to select multiple items in a page selector, I get the grand-total of the cube instead of the total for my sub-selection. What I do not get is that it works for dim attributes with few members and it doe snot with dim attributes with more members.

The most frustrating part is that the bug exist ONLY in Excel 2003 (SP2).

I try the exact same cube in its XL03 and its Xl07 version, for the exact same view and setting I see that Excel is generating quite a different query in 03 and 07.

I have no control over the way Excel create the query. I tried to change things in the cube to coax XL03 to generate a query that works and I cannot get it right.

I cannot use XL2007 in production due to corporate policies.

Is there any way we could get a service pack for XL03, or any way to define the cube to force XL03 to generate correct query?

I cannot reproduce this behavior in the AdventureWorks sample cube, probably because it has not enough data.

Thanks for your kind attention,

Philippe

XL 2007 Correct query is as follow:

Code Snippet

SELECT NON EMPTY
Hierarchize(AddCalculatedMembers({DrilldownLevel({[Weeks].[All Weeks]})}))
DIMENSION PROPERTIES PARENT_UNIQUE_NAME ON COLUMNS
FROM (SELECT ({[PTI3 CD].[All].[PAA],[PTI3 CD].[All].[PAB]})
ON COLUMNS FROM [ST_Crawl])
WHERE ([Data Switch].[Data Switch].&[On],[Exclusions].[Exclusions].&[Enabled],
[Quarters RSD].[Quarter 00].&[200703],
[Products].[All],[Measures].[Crawl RSD]) CELL PROPERTIES VALUE

XL 2003 query not working is as follow:

Code Snippet

WITH MEMBER
[PTI3 CD].[XL_QZX] AS 'Aggregate ( { [PTI3 CD].[All].[PAB] , [PTI3 CD].[All].[PAA] } )'
SELECT NON EMPTY HIERARCHIZE(AddCalculatedMembers({DrillDownLevel({[Weeks].[All Weeks]})}))
DIMENSION PROPERTIES PARENT_UNIQUE_NAME ON COLUMNS FROM [ST_Crawl]
WHERE ([Measures].[Crawl RSD], [Data Switch].[Data Switch].&[On],
[Exclusions].[Exclusions].&[Enabled], [Quarters RSD].[Quarter 00].&[200703],
[PTI3 CD].[XL_QZX], [Products].[All])

Hi Philippe,

Not a solution, but maybe another data point - does this modification to the XL 2003 query still not work right?

Code Snippet

SELECT NON EMPTY HIERARCHIZE(AddCalculatedMembers(

{DrillDownLevel({[Weeks].[All Weeks]})}))
DIMENSION PROPERTIES PARENT_UNIQUE_NAME ON COLUMNS

FROM [ST_Crawl]
WHERE ([Measures].[Crawl RSD], [Data Switch].[Data Switch].&[On],
[Exclusions].[Exclusions].&[Enabled], [Quarters RSD].[Quarter 00].&[200703],
{[PTI3 CD].[All].[PAB], [PTI3 CD].[All].[PAA]}, [Products].[All])

|||

I tried your suggestion and get the same issue, it returns the total.

If I try to query the immediate parent level then I get correct result with just one curious clue, the All weeks item would be "Error" but the data I need is just OK in that case as shown bellow. So in XL03 for level 3 it is wrong and for level 2 it is right while the same is right in Xl07 for both level 2 and 3. Very out of my limited undestanding.

This query for level 2 returns correct result. I do not see much difference except for the order of the last segment of the query. i tried all type of things like changing the dimension and hierarchies in every possible way and still no go with XL03.

i took great care of cleaning the underlying data up to perfection in that particular cube however this problem is a problem I am experiencing in many cubes and Despite creating logical keys, set the Cardinality and the RelationshipType as well as getting a rid of all star schema type of dimension, I still hit the wall. Note that level 3 (PTI3) has 217 members and that any level bellow that with more members will fail with the same issue.

I also tried to change the visual total property on the server side and the 2 options available on the Excel side, no luck.

Not that these cubes use calculated members, however even if I try a pure measure it still bug. So what could I do? Create a cube with no calcualte measures and same dimension structure? But still XL07 works while XL03 does not.

Should I post the cube code?

Code Snippet

WITH MEMBER

[PTI2 CD].[XL_QZX] AS 'Aggregate ( { [PTI2 CD].[All].[PB] , [PTI2 CD].[All].[PA] } )'

SELECT NON EMPTY HIERARCHIZE(AddCalculatedMembers({DrillDownLevel({[Weeks].[All Weeks]})}))

DIMENSION PROPERTIES PARENT_UNIQUE_NAME ON COLUMNS FROM [ST_Crawl]

WHERE ([Measures].[Crawl RSD], [Data Switch].[Data Switch].&[On],

[Exclusions].[Exclusions].&[Enabled], [Quarters RSD].[Quarter 00].&[200703],

[PTI3 CD].[All], [PTI2 CD].[XL_QZX], [Products].[All])

|||"Note that level 3 (PTI3) has 217 members and that any level bellow that with more members will fail with the same issue" - but I thought that PTl3 is a different dimension than PTl2. Could you explain how these "levels" are related, and their structures? As far as the cube script, you could post the sections that relate to the query. For example, if [Crawl RSD] is a calculated measure - and any scoped calculations which apply as well.|||

Guys,

I cannot post the dimension code, too big, however I am getting closer to understand this Excel 2003 problem with cubes.

Here is a query that works very well.

Works

WITH MEMBER

[PTI3 CD].[XL_QZX] AS 'Aggregate ( { [PTI3 CD].[All].[PAB] , [PTI3 CD].[All].[PAA] } )'

SELECT NON EMPTY HIERARCHIZE(AddCalculatedMembers({DrillDownLevel({[Weeks].[All Weeks]})}))

DIMENSION PROPERTIES PARENT_UNIQUE_NAME ON COLUMNS FROM [ST_Crawl]

WHERE ([Measures].[Bill Amt], [Data Switch].[Data Switch].&[On], [Pti2 CD Desc].[All],

[Quarters RSD].[Quarter 00].[All], [PTI3 CD].[XL_QZX])

Here a query which does not work, it returns the grand total. The difference is in red.

Does not work

WITH MEMBER

[PTI3 CD].[XL_QZX] AS 'Aggregate ( { [PTI3 CD].[All].[PAB] , [PTI3 CD].[All].[PAA] } )'

SELECT NON EMPTY HIERARCHIZE(AddCalculatedMembers({DrillDownLevel({[Weeks].[All Weeks]})}))

DIMENSION PROPERTIES PARENT_UNIQUE_NAME ON COLUMNS FROM [ST_Crawl]

WHERE ([Measures].[Bill Amt], [Data Switch].[Data Switch].&[On], [Pti2 CD Desc].[All],

[Quarters RSD].[Quarter 00].[All],

[Products Hierarchy].[All], [PTI3 CD].[XL_QZX])

The way this section of the dimension is build is as follow.

1 Hierarchy called Products Hierachy with Business, PTI2 CD Desc, PTI3 CD, Product ID

- Product ID is the dimension key, it has an attribute relationship ROOT PART ID rigid, many

Other dimension attributes are

- ROOT PART ID attribute relationship PTI3 CD rigid, many

- PTI3 CD attribute relationship PTI2 CD Desc, rigid, many

- PTI2 cd Desc Attribute relationship Business, rigid, many

- Business

The problem is that if I have both the hierachy and the attributes, excel (2003 only) will include conflictual limits in its query. If I remove the hierarchy it work.

I can use the hierachy when the PTI3 attribute is in the excel however to use PTI3 I must remove the hierarchy...

Users likes both direct access to any attribute and hierarchy browsing, I must educate them not to have both at the same time.

I tried to rebuild the cube from scratch with no calculated measures, no go. I spotted another cube where I have the exact same dimension structure and where it works. I will investigate this to see if there is a difference in the data or structure.

Any idea?|||

One more clue.

If i remove the time dimension from the view, Sub-Select works when both the attribute and the hierarchy are in the cube.

See this

Code Snippet

WITH MEMBER

[PTI3 CD].[XL_QZX] AS 'Aggregate ( { [PTI3 CD].[All Products].[PAB] ,

[PTI3 CD].[All Products].[PAA] } )'

SELECT FROM [ST_Crawl]

WHERE ([Measures].[Bill Amt], [Exclusions].[All Products].[Enabled],

[Data Switch].[Data Switch].&[On], [Products Hierarchy].[All Products],

[Pti2 CD Desc].[All Products],

[PTI3 CD].[XL_QZX])

sql

Multi-select problem with Excel as front-end

Hello,

I am trying to find a solution to a very elusive problem.

I have reviewed carefully every aspects of my cube as well as my test case and made only little progress.

When using Excel to connect to an AS2005 SP2 cube, if I try to select multiple items in a page selector, I get the grand-total of the cube instead of the total for my sub-selection. What I do not get is that it works for dim attributes with few members and it doe snot with dim attributes with more members.

The most frustrating part is that the bug exist ONLY in Excel 2003 (SP2).

I try the exact same cube in its XL03 and its Xl07 version, for the exact same view and setting I see that Excel is generating quite a different query in 03 and 07.

I have no control over the way Excel create the query. I tried to change things in the cube to coax XL03 to generate a query that works and I cannot get it right.

I cannot use XL2007 in production due to corporate policies.

Is there any way we could get a service pack for XL03, or any way to define the cube to force XL03 to generate correct query?

I cannot reproduce this behavior in the AdventureWorks sample cube, probably because it has not enough data.

Thanks for your kind attention,

Philippe

XL 2007 Correct query is as follow:

Code Snippet

SELECT NON EMPTY
Hierarchize(AddCalculatedMembers({DrilldownLevel({[Weeks].[All Weeks]})}))
DIMENSION PROPERTIES PARENT_UNIQUE_NAME ON COLUMNS
FROM (SELECT ({[PTI3 CD].[All].[PAA],[PTI3 CD].[All].[PAB]})
ON COLUMNS FROM [ST_Crawl])
WHERE ([Data Switch].[Data Switch].&[On],[Exclusions].[Exclusions].&[Enabled],
[Quarters RSD].[Quarter 00].&[200703],
[Products].[All],[Measures].[Crawl RSD]) CELL PROPERTIES VALUE

XL 2003 query not working is as follow:

Code Snippet

WITH MEMBER
[PTI3 CD].[XL_QZX] AS 'Aggregate ( { [PTI3 CD].[All].[PAB] , [PTI3 CD].[All].[PAA] } )'
SELECT NON EMPTY HIERARCHIZE(AddCalculatedMembers({DrillDownLevel({[Weeks].[All Weeks]})}))
DIMENSION PROPERTIES PARENT_UNIQUE_NAME ON COLUMNS FROM [ST_Crawl]
WHERE ([Measures].[Crawl RSD], [Data Switch].[Data Switch].&[On],
[Exclusions].[Exclusions].&[Enabled], [Quarters RSD].[Quarter 00].&[200703],
[PTI3 CD].[XL_QZX], [Products].[All])

Hi Philippe,

Not a solution, but maybe another data point - does this modification to the XL 2003 query still not work right?

Code Snippet

SELECT NON EMPTY HIERARCHIZE(AddCalculatedMembers(

{DrillDownLevel({[Weeks].[All Weeks]})}))
DIMENSION PROPERTIES PARENT_UNIQUE_NAME ON COLUMNS

FROM [ST_Crawl]
WHERE ([Measures].[Crawl RSD], [Data Switch].[Data Switch].&[On],
[Exclusions].[Exclusions].&[Enabled], [Quarters RSD].[Quarter 00].&[200703],
{[PTI3 CD].[All].[PAB], [PTI3 CD].[All].[PAA]}, [Products].[All])

|||

I tried your suggestion and get the same issue, it returns the total.

If I try to query the immediate parent level then I get correct result with just one curious clue, the All weeks item would be "Error" but the data I need is just OK in that case as shown bellow. So in XL03 for level 3 it is wrong and for level 2 it is right while the same is right in Xl07 for both level 2 and 3. Very out of my limited undestanding.

This query for level 2 returns correct result. I do not see much difference except for the order of the last segment of the query. i tried all type of things like changing the dimension and hierarchies in every possible way and still no go with XL03.

i took great care of cleaning the underlying data up to perfection in that particular cube however this problem is a problem I am experiencing in many cubes and Despite creating logical keys, set the Cardinality and the RelationshipType as well as getting a rid of all star schema type of dimension, I still hit the wall. Note that level 3 (PTI3) has 217 members and that any level bellow that with more members will fail with the same issue.

I also tried to change the visual total property on the server side and the 2 options available on the Excel side, no luck.

Not that these cubes use calculated members, however even if I try a pure measure it still bug. So what could I do? Create a cube with no calcualte measures and same dimension structure? But still XL07 works while XL03 does not.

Should I post the cube code?

Code Snippet

WITH MEMBER

[PTI2 CD].[XL_QZX] AS 'Aggregate ( { [PTI2 CD].[All].[PB] , [PTI2 CD].[All].[PA] } )'

SELECT NON EMPTY HIERARCHIZE(AddCalculatedMembers({DrillDownLevel({[Weeks].[All Weeks]})}))

DIMENSION PROPERTIES PARENT_UNIQUE_NAME ON COLUMNS FROM [ST_Crawl]

WHERE ([Measures].[Crawl RSD], [Data Switch].[Data Switch].&[On],

[Exclusions].[Exclusions].&[Enabled], [Quarters RSD].[Quarter 00].&[200703],

[PTI3 CD].[All], [PTI2 CD].[XL_QZX], [Products].[All])

|||"Note that level 3 (PTI3) has 217 members and that any level bellow that with more members will fail with the same issue" - but I thought that PTl3 is a different dimension than PTl2. Could you explain how these "levels" are related, and their structures? As far as the cube script, you could post the sections that relate to the query. For example, if [Crawl RSD] is a calculated measure - and any scoped calculations which apply as well.|||

Guys,

I cannot post the dimension code, too big, however I am getting closer to understand this Excel 2003 problem with cubes.

Here is a query that works very well.

Works

WITH MEMBER

[PTI3 CD].[XL_QZX] AS 'Aggregate ( { [PTI3 CD].[All].[PAB] , [PTI3 CD].[All].[PAA] } )'

SELECT NON EMPTY HIERARCHIZE(AddCalculatedMembers({DrillDownLevel({[Weeks].[All Weeks]})}))

DIMENSION PROPERTIES PARENT_UNIQUE_NAME ON COLUMNS FROM [ST_Crawl]

WHERE ([Measures].[Bill Amt], [Data Switch].[Data Switch].&[On], [Pti2 CD Desc].[All],

[Quarters RSD].[Quarter 00].[All], [PTI3 CD].[XL_QZX])

Here a query which does not work, it returns the grand total. The difference is in red.

Does not work

WITH MEMBER

[PTI3 CD].[XL_QZX] AS 'Aggregate ( { [PTI3 CD].[All].[PAB] , [PTI3 CD].[All].[PAA] } )'

SELECT NON EMPTY HIERARCHIZE(AddCalculatedMembers({DrillDownLevel({[Weeks].[All Weeks]})}))

DIMENSION PROPERTIES PARENT_UNIQUE_NAME ON COLUMNS FROM [ST_Crawl]

WHERE ([Measures].[Bill Amt], [Data Switch].[Data Switch].&[On], [Pti2 CD Desc].[All],

[Quarters RSD].[Quarter 00].[All],

[Products Hierarchy].[All], [PTI3 CD].[XL_QZX])

The way this section of the dimension is build is as follow.

1 Hierarchy called Products Hierachy with Business, PTI2 CD Desc, PTI3 CD, Product ID

- Product ID is the dimension key, it has an attribute relationship ROOT PART ID rigid, many

Other dimension attributes are

- ROOT PART ID attribute relationship PTI3 CD rigid, many

- PTI3 CD attribute relationship PTI2 CD Desc, rigid, many

- PTI2 cd Desc Attribute relationship Business, rigid, many

- Business

The problem is that if I have both the hierachy and the attributes, excel (2003 only) will include conflictual limits in its query. If I remove the hierarchy it work.

I can use the hierachy when the PTI3 attribute is in the excel however to use PTI3 I must remove the hierarchy...

Users likes both direct access to any attribute and hierarchy browsing, I must educate them not to have both at the same time.

I tried to rebuild the cube from scratch with no calculated measures, no go. I spotted another cube where I have the exact same dimension structure and where it works. I will investigate this to see if there is a difference in the data or structure.

Any idea?|||

One more clue.

If i remove the time dimension from the view, Sub-Select works when both the attribute and the hierarchy are in the cube.

See this

Code Snippet

WITH MEMBER

[PTI3 CD].[XL_QZX] AS 'Aggregate ( { [PTI3 CD].[All Products].[PAB] ,

[PTI3 CD].[All Products].[PAA] } )'

SELECT FROM [ST_Crawl]

WHERE ([Measures].[Bill Amt], [Exclusions].[All Products].[Enabled],

[Data Switch].[Data Switch].&[On], [Products Hierarchy].[All Products],

[Pti2 CD Desc].[All Products],

[PTI3 CD].[XL_QZX])

Monday, March 12, 2012

multiple tables

Hi

I am trying to import an excel spreadsheet into a sql server database. The problem is I need the information in the spreadsheet to be imported into 3 different tables. I thought of transfering all details into a temporary table and then setting 3 triggers for each transfer of information. But this seems very inefficient. I know there should be an easier way to do this in dts.

Any help would be greatly appreciated

ThanksCreate a DTS package with Excel spreadSheet as the Source and the SQL Server as the Destination.
Create 3 Destination SQL Server and Define a connection between the one Excel Source and the three SQL Server destination table. It should just work perfect for you.|||Hi

Thanks for your reply...is that a connection using the transform data task??

Thanks|||Yes you have to set the Transform data task.|||Hi

Is this just using a for loop in the activeX script and incrementing each time...I have been trying to do this, but it keeps returning an error.

Thanks|||In the DTS tool bar there is a tool called Transofm task. Just select the source(excel) and Destination(sql server) and run it. You don't need to code any ActiveX script unless you plan to do some data messaging during the import/|||Also refer to http://www.sqldts.com for code examples on ActiveX & DTS goodies.

Wednesday, March 7, 2012

Multiple Sites in Export

Sali zäme :-)
In a report, i have got multiple pages as it should be. Now, i'd like to
have just 1 sheet in an excel export including all data, but several pages in
preview are generating several sheets in excel. Any idea?
thxRemove all page breaks. Each time a page break is encountered a new excel
tab is generated.
--
Bruce Johnson [MSFT]
Microsoft SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"SwissSmurf" <SwissSmurf@.discussions.microsoft.com> wrote in message
news:79E05569-686E-4D28-BFCC-D341F7C4C14F@.microsoft.com...
> Sali zäme :-)
> In a report, i have got multiple pages as it should be. Now, i'd like to
> have just 1 sheet in an excel export including all data, but several pages
in
> preview are generating several sheets in excel. Any idea?
> thx|||Hi Bruce
How are you today? Hope you're fine :-)
In out report, we have got one table with a lot of data. In
table-properties, grouping and sorting, we inserted
"=Ceiling(RowNumber(Nothing)/15)" as a "group on"-expression and "page break
at end" to create pagebreaks after 15 entries. In this case, i can't remove
this property. Hope you have got an idea to resolve this problem :-)
Greez and thx,
SwissSmurf
"Bruce Johnson [MSFT]" wrote:
> Remove all page breaks. Each time a page break is encountered a new excel
> tab is generated.
> --
> Bruce Johnson [MSFT]
> Microsoft SQL Server Reporting Services
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "SwissSmurf" <SwissSmurf@.discussions.microsoft.com> wrote in message
> news:79E05569-686E-4D28-BFCC-D341F7C4C14F@.microsoft.com...
> > Sali zäme :-)
> >
> > In a report, i have got multiple pages as it should be. Now, i'd like to
> > have just 1 sheet in an excel export including all data, but several pages
> in
> > preview are generating several sheets in excel. Any idea?
> >
> > thx
>
>

multiple sheets in excel

I know how to use ssis to import data from the sheet in an excel file.
How do you use ssis to get the data out from different sheets into the database?
Is there such functionality please?
Thanks

arkiboys wrote:

I know how to use ssis to import data from the sheet in an excel file.
How do you use ssis to get the data out from different sheets into the database?
Is there such functionality please?
Thanks

Hi,

I haven't tried this yet, but, there can be at least 2 ways of doing this:

1) Create separate Data Flow Tasks for each sheet.

2) Use the Foreach Loop Container to loop through all the available sheets in the Excel, provided, the structure remains same.

Regards,

B@.ns

|||

I know how to loop through files but not sheets in one file

Do you know how this is done please?

|||I used Sript and following code:


Code Snippet

Private Sub ShowExcelWorksheets(ByVal File As String)
Dim excelTables As System.Data.DataTable
Dim excelTable As System.Data.DataRow
'Dim currentTable As String
Dim excelConnection As System.Data.OleDb.OleDbConnection = New System.Data.OleDb.OleDbConnection(ScriptMain.CreateExcelConnectionString(File))
excelConnection.Open()
excelTables = excelConnection.GetSchema("Tables")
For Each excelTable In excelTables.Rows
'Me.ComboBoxWorkSheet.Items.Add(excelTable.Item("TABLE_NAME").ToString)
Next
excelConnection.Close()

End Sub


|||

There is a good how-to article on using the Foreach loop with ADO.NET Schema Rowset enumerator to do this.

http://technet.microsoft.com/en-us/library/ms345182.aspx

multiple sheets in excel

I know how to use ssis to import data from the sheet in an excel file.
How do you use ssis to get the data out from different sheets into the database?
Is there such functionality please?
Thanks

arkiboys wrote:

I know how to use ssis to import data from the sheet in an excel file.
How do you use ssis to get the data out from different sheets into the database?
Is there such functionality please?
Thanks

Hi,

I haven't tried this yet, but, there can be at least 2 ways of doing this:

1) Create separate Data Flow Tasks for each sheet.

2) Use the Foreach Loop Container to loop through all the available sheets in the Excel, provided, the structure remains same.

Regards,

B@.ns

|||

I know how to loop through files but not sheets in one file

Do you know how this is done please?

|||I used Sript and following code:


Code Snippet

Private Sub ShowExcelWorksheets(ByVal File As String)
Dim excelTables As System.Data.DataTable
Dim excelTable As System.Data.DataRow
'Dim currentTable As String
Dim excelConnection As System.Data.OleDb.OleDbConnection = New System.Data.OleDb.OleDbConnection(ScriptMain.CreateExcelConnectionString(File))
excelConnection.Open()
excelTables = excelConnection.GetSchema("Tables")
For Each excelTable In excelTables.Rows
'Me.ComboBoxWorkSheet.Items.Add(excelTable.Item("TABLE_NAME").ToString)
Next
excelConnection.Close()

End Sub


|||

There is a good how-to article on using the Foreach loop with ADO.NET Schema Rowset enumerator to do this.

http://technet.microsoft.com/en-us/library/ms345182.aspx

Monday, February 20, 2012

Multiple Rows

Hi, can anyone think of how to get round this. I am using MS Excel Query on my Oracle database.

I want to make a spreadsheet showing account number, customer 1, customer 2, customer 3. There is an accounts table, an accounts_links table which links the customers to the accounts and a customers table.

On the accounts_links table there is one row for each customer on an account with a "holder number" to say if it is customer 1, 2 or 3.

At the moment I am only bringing back accounts where there are 3 customers. Some accounts will only have 1 or 2 customers.

I thought to bring in the accounts_links and customers tables in three times now it is just multiplying all the rows together!

Can anyone think of a way round this to run it in one sql, I don't want to have to use excel functions.

Thanks,
BethIf I've interpreted your issue correctly, here is one suggestion to try:
SELECT a.account_number, MAX(CASE a1.holder_number WHEN 1 THEN c.customer_name END) customer_1,
MAX(CASE a1.holder_number WHEN 2 THEN c.customer_name END) customer_2,
MAX(CASE a1.holder_number WHEN 3 THEN c.customer_name END) customer_3
FROM accounts a, accounts_link al, customer c
WHERE a.a_primary_key = al.al_primary_key
AND a1.al_primary_key = c.c_primary_key
GROUP BY a.account_number

You'll have to edit this to provide the appropriate columns for the WHERE join columns.

Originally posted by elisabeth
Hi, can anyone think of how to get round this. I am using MS Excel Query on my Oracle database.

I want to make a spreadsheet showing account number, customer 1, customer 2, customer 3. There is an accounts table, an accounts_links table which links the customers to the accounts and a customers table.

On the accounts_links table there is one row for each customer on an account with a "holder number" to say if it is customer 1, 2 or 3.

At the moment I am only bringing back accounts where there are 3 customers. Some accounts will only have 1 or 2 customers.

I thought to bring in the accounts_links and customers tables in three times now it is just multiplying all the rows together!

Can anyone think of a way round this to run it in one sql, I don't want to have to use excel functions.

Thanks,
Beth