×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Script Help

Script Help

Script Help

(OP)
I need some help on the following. I have 2 files that I can join to create one set of results. I then need to duplicate this and compare across both sets of results and ideally join with another file.

Details are as follows :

File Name : MGLINE

Fields : MRTRNR, MRRORN, MRITNO, MRTRQT

Data :

410 213 Item1 10
410 213 Item2 20
410 213 Item3 30
411 ___ Item1 10
411 ___ Item2 20
411 ___ Item3 30
412 ___ Item1 20
412 ___ Item2 10
412 ___ Item3 20

File : MGHEAD

Fields : MGTRNR, MGTRTP, MGTRDT, MGTWLO, MGWHLO

Date :

410 R01 280609 ___ 190
411 DR1 150609 190 102
412 DR0 160609 190 102

In the above example I want join MGHEAD and MGLINE on MRTRNR. (I have written the SQL for this no problem)

This should give me a file that looks like :

410 R01 280609 ___ 190 213 Item1 10
410 R01 280609 ___ 190 213 Item2 20
410 R01 280609 ___ 190 213 Item3 30
411 DR1 150609 190 102 ___ Item1 10
411 DR1 150609 190 102 ___ Item2 20
411 DR1 150609 190 102 ___ Item2 30
412 DR0 160609 190 102 ___ Item1 20
412 DR0 160609 190 102 ___ Item2 10
412 DR0 160609 190 102 ___ Item3 20

I need 2 sets of the same data.

I then want to match where a.MGWHSL=b.MGTWLO and a.MRTRTP<>b.MRTRTP and a.MRITNO=b.MRITNO and a.MRTRQT=b.MRTRQT

The result I expect to show is this :

410 R01 280609 411 DR1 150609 213 190 Item1 10
410 R01 280609 411 DR1 150609 213 190 Item2 20
410 R01 280609 411 DR1 150609 213 190 Item3 30

but really all I need is 1 return of

410 R01 280609 411 DR1 150609 213 190

but I can filter out manually if need be. I would ideally like to join this to another file using a join on MGRORN.

Hope this is enough information.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close