Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • 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!

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

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...Praise should be given to the Forum managers or the Tipmasters - they are what make it work - give them extra recognition!!! They are timely (prompt - unlike ACTUAL support sites) and on the ball!!!..."

Geography

Where in the world do Tek-Tips members come from?
makeitwork09 (TechnicalUser)
2 Aug 12 8:56
We have Microsoft SQL Server 2005.

I have been having a hard time conceptualizing what I need to do.

We have fields called loan, loan_ref, and property.

The loan_ref can have one or more loans.

A loan can have one or more properties associated with it.

A property can be associated with one ore more loans.

(1) I need to do one thing if a loan has more than property.

(2) Another thing if a property has more than one loan.

(3) And a different thing if there are multiple loans with multiple loans.

Note, recall that loan_ref can have one or more loans. I think that means I should let that be my focus in helping to identify those buckets.

What I cannot conceptualize is how to identify the three buckets mentioned above.

Once I figure that, I can then move onto doing what needs to be done for each of the three scenarios mentioned.

Thanks
simian336 (Programmer)
2 Aug 12 9:18
Perhaps you can post some example data and what you want to do but I guess you are just wanting to some come grouping.

Select loan_ref, count(property)
from table
group by loan_ref

Simi
makeitwork09 (TechnicalUser)
2 Aug 12 13:43
Thanks Simi,

Here are some samples

(a) one loan, one property
loan loanref property
3333351 3333351 RINK
3343403 X000111 FIFTH

(b) one loan, > one property
loan loanref property
3333346 3333346 CENTER1
3333346 3333346 CENTER2

(c) one property, > one loan
loan loanref property
3333081 3333081 PARK1
3333376 3333376 PARK1
3343384 X000144 MAIN
3327942 X000144 MAIN

(d) > one loan, > one property
loan loanref property
3343406 X000135 FLAGI
3343408 X000135 FLAGII
3343998 X000174 MAPLE
3343998 X000174 EAST
3343998 X000174 MERKER
3343106 X000174 MAPLE
3343106 X000174 EAST
3343106 X000174 MERKER

Using the above, (a) is staight forward, because that is like doing a simple query.

My issue is with being able to identify (b), (c), and (d).

After I identify each of those 3 buckets, I need to do something with them.

I need to first, however, know how to put them in the right bucket.

Thanks



makeitwork09 (TechnicalUser)
2 Aug 12 17:41
I believe I have figured it out.

It may not be the best way to do it, but I believe it worked.

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!

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