dbTalk Databases Forums  

a tricky view to create in Access; SQL is welcome !!!

comp.database.ms-access comp.database.ms-access


Discuss a tricky view to create in Access; SQL is welcome !!! in the comp.database.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Stefan
 
Posts: n/a

Default a tricky view to create in Access; SQL is welcome !!! - 07-07-2004 , 09:50 AM






Hi I am now sitting for almost ages in front of the screen, and may be
someone can help me...

Here's the thing

I have a table that looks like the following:

Mat-Nr|Package-Rule|Package-Class|Package-Material|Package-Nr|Amount|


Mat-Nr: There are several million different materials
Package-Rule: there are only in total 2 different package rules
Package-Class: there are in total 9 different classes
Package-Material: there are 4 different package materials
Package-Nr: each package material has 1 or more package-numbers
Amount: there is at least 1 material in the amount

An example looks like this:

Mat-Nr|Package-Rule|Package-Class|Package-Material|Package-Nr|Amount|
102 01 01 V 003 10
102 01 01 Z 045 03
116 01 01 V 056 23
116 01 01 Z 067 20


My problem is now, I have to create a query or view in Access 2000 so
that the following information is in ONE row:

Mat-Nr|Package-Rule|Package-Class|Package-Material|Package-Nr|Amount|
102 01 01 V 003 10
..
..
..
Package-Material|Package-Nr|Amount|
Z 045 03
..
..
..

thank you very much
Stefan

Reply With Quote
  #2  
Old   
Ray
 
Posts: n/a

Default Re: a tricky view to create in Access; SQL is welcome !!! - 07-13-2004 , 11:51 AM






al_capone (AT) web (DOT) de (Stefan) wrote in message news:<249f98b3.0407070650.75f1ead5 (AT) posting (DOT) google.com>...
Quote:
Hi I am now sitting for almost ages in front of the screen, and may be
someone can help me...

Here's the thing

I have a table that looks like the following:

Mat-Nr|Package-Rule|Package-Class|Package-Material|Package-Nr|Amount|


Mat-Nr: There are several million different materials
Package-Rule: there are only in total 2 different package rules
Package-Class: there are in total 9 different classes
Package-Material: there are 4 different package materials
Package-Nr: each package material has 1 or more package-numbers
Amount: there is at least 1 material in the amount

An example looks like this:

Mat-Nr|Package-Rule|Package-Class|Package-Material|Package-Nr|Amount|
102 01 01 V 003 10
102 01 01 Z 045 03
116 01 01 V 056 23
116 01 01 Z 067 20


My problem is now, I have to create a query or view in Access 2000 so
that the following information is in ONE row:

Mat-Nr|Package-Rule|Package-Class|Package-Material|Package-Nr|Amount|
102 01 01 V 003 10
.
.
.
Package-Material|Package-Nr|Amount|
Z 045 03
.
.
.

thank you very much
Stefan
Hello Stefan,

Just one question. Are you dealing with only two records for each
Mat-Nr field data? Meaning 102, 102, 166, 166 etc.?

If so, then perhaps you can make a grouping query to get
your data result like the following.

Create a query using your source table with all the fields.

Next, change it to a grouping/summing query.

Then, edit your last three fields to be like the example below.

PackMat01: Package-Material
PackNr01:Package-Nr
Amount01: Amount

Now, change Grouping to First

Then add 3 more fields accordingly.

PackMat02: Package-Material
PackNr02:Package-Nr
Amount02: Amount

Now, change Grouping to Last

Run the query. What this should show is the First record for 102
and the last record for 102 in your grouping query for the 01 and
02 field groups according to your requirements.

Good luck!

Regards,

Ray


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.