Showing posts with label grouped. Show all posts
Showing posts with label grouped. Show all posts

Wednesday, March 28, 2012

Knowing what is grouped?!


Hello!

I have a table "A" like this shown bellow and a problem...

Vr Kon Value ID DZ PRM 22900 -16.00 101 M PRM 22900 16.00 102 P PRM 22900 -728.19 103 M PRM 22900 728.19 104 P


I am doing simle grouping on this table...
Grouping is by Vr,Kon,Dz and Value is summed.

Select is like this
SELECT Vr,Kon,sum(value) from TableA
GROUP BY vr,kon,dz
So, my results look like this:

Vr Kon Value 1 PRM 22900 -744.19 2 PRM 22900 744.19


What I need to know is to somehow link row 1 from my results to IDs 101 and 103 from table and ofcourse row 2 to IDs 102 and 104...
Since english is not my native language i'll try to use colurs in effort to
clarify desired results...

I need to know that row 1 was product of grouping rows with IDs 101 and 103.
So my desired results will look like this...

Vr Kon Value Grouped_IDs 1 PRM 22900 -744.19 101,103 2 PRM 22900 744.19 102,104


or in ideal case same stuff but in relational table... like this:

Result_Row Grouped_ID_From_TableA 1 101 1 103 2 102 2 104

Any thoughts?!

p.s.
I forgot to say that I am working on SQL Server 2000...<marko2511@.discussions..microsoft.com> wrote in message news:167b3c86-3b1e-4611-ab79-4d46cf72284e_WBRev1_@.discussions..microsoft.com...What I need to know is to somehow link row 1 from my results to IDs 1 and 3 from table and ofcourse row 2 to IDs 2 and 4... I'm not sure what "link" means in this context. Can you show the output you're hoping for? -- Adam MachanicPro SQL Server 2005, available nowhttp://www..apress.com/book/bookDisplay.html?bID=457--|||I have edited my first post in effort to try clarify things little better...
Please, read again...|||Ah! In that case: http://www.aspfaq.com/show.asp?id=2529 -- Adam MachanicPro SQL Server 2005, available nowhttp://www..apress.com/book/bookDisplay.html?bID=457-- <marko2511@.discussions..microsoft.com> wrote in message news:7f30a711-c63a-4a87-b121-bc7ca1388a93@.discussions.microsoft.com...I have edited my first post in effort to try clarify things little better...Please, read again...|||Seams it's should work but it's late at night here so i'll check it in the morning
and get back here with results...
Regards.

Friday, February 24, 2012

Keep Table Group on Same Page

I have a report that consists of a table containing invoices grouped by
Customer. I'd like to keep all invoices for any given customer on the same
page, but without needing a page break after each customer (each page can fit
about 12 or so groups on it).
Does anyone know how to do this?
I found a thread dated 5/20/2005 called "Control Page Breaking in Detail
(Keep Together)". I think some of the people on that thread are also trying
to do what I want to do.
I tried the method suggested by Matt Temple at the end of the thread, but
this did not have the desired effect. This method resulted in keeping each
group on the same page BUT meant that only the first invoice for each
customer was displayed.
Any ideas?
Thanks,
RobRight, I had another go at Matt's suggestion (included below for convenience)
from the other thread. I was doing step 7 wrong. I've now redone it and am
getting closer, but still without the effect I need.
The instructions ensure that all the detail elements within a group are kept
on the same page, but sometimes the group header is shown at the bottom of
the previous page instead of with the detail elements.
My next step was to edit the Grouping and Sorting Properties of the group to
add a check next to "Repeat group header". This ensures that when a block of
detail elements are kept together by taking them to the next page, the group
header is repeated with them. However, I'm still left with a copy of the
group header at the bottom of the previous page.
I can't be the only person who's wanted to do this. Can anyone help?
______________________________________
Instructions to keep group elements together:
1) Right-click border of table containing the elements
2) Select "Properties"
3) Go to the "General" tab, if not already displayed
4) Place a check in the "Fit table on one page if possible" checkbox
5) Go to the "Groups" tab
6) Click on the "Details grouping..." button
7) Select the elements which comprise of the detail group you want to keep
together
8) Click "OK"
9) Click "OK" again
10) Test the modified design
"Rob Nelder" wrote:
> I have a report that consists of a table containing invoices grouped by
> Customer. I'd like to keep all invoices for any given customer on the same
> page, but without needing a page break after each customer (each page can fit
> about 12 or so groups on it).
> Does anyone know how to do this?
> I found a thread dated 5/20/2005 called "Control Page Breaking in Detail
> (Keep Together)". I think some of the people on that thread are also trying
> to do what I want to do.
> I tried the method suggested by Matt Temple at the end of the thread, but
> this did not have the desired effect. This method resulted in keeping each
> group on the same page BUT meant that only the first invoice for each
> customer was displayed.
> Any ideas?
> Thanks,
> Rob