473,396 Members | 2,037 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How can I conditionally join result sets from (3) tables based on common criteria?

I have three tables that all have "loan" in common.

Property
Investorloans
Loans

I used the following statements to pull all the loans for the investorid (03, 04, 06, 10) by matching the loan number(s) from each table.

I also want to join the information from the property file to the result set (again, "loan" is the common record match".

SELECT investorloans.investorid, investorloans.loan, loans.*
FROM investorloans
FULL JOIN loans
ON investorloans.loan=loans.loan
WHERE investorloans.investorid in("03","04", "06", "10")
order by investorid asc


I am NOT a skilled programmer so sorry for asking something that might be so simple.

One last piece of information. I could join the property table and the loans table by joining them based on the loan number - BUT, in the above problem, I only want the loans by the set of investors (i.e 3,5,5,10). That might make my problem more clear - the way I do it now is manually and time intensive by running multiple queries and retrieving the loan numbers and then having to paste them into a conditional statement and I know there is a better way if I knew what I was doing :-)

Thanks!!
Dec 8 '10 #1
1 1676
code green
1,726 Expert 1GB
Not sure I understand the problem but what is wrong with this
Expand|Select|Wrap|Line Numbers
  1. SELECT investorloans.investorid, investorloans.loan, loans.*
  2. FROM investorloans
  3. FULL JOIN loans
  4. ON investorloans.loan=loans.loan
  5. JOIN property
  6. ON investorloans.loan=property.loan
  7. WHERE investorloans.investorid in("03","04", "06", "10")
  8. order by investorid asc
Dec 9 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Beyonder | last post by:
I have five tables in my database, there are actually NO common fields between them, not even a KEY or ID or anything like that, except for the "body" of a blob field. and that text is not...
1
by: TeleTech1212 | last post by:
I am trying to select specific columns from multiple tables based on a common identifier found in each table. For example, the three tables: PUBACC_AC PUBACC_AM PUBACC_AN each have a...
5
by: Stanley Sinclair | last post by:
I have a need to return multiple result sets from a stored procedure. Want that SP to call others to get the data. Win2003, db2 8.1.5. Can't figure out how to handle open cursors, and return...
1
by: EyesFriedOpen | last post by:
I was trying to post this to the IBM DB2 forum, however I do not have the "New Post" button available when I view the IBM DB2 forum. Therefore, I apologize if this is not the right place for this. ...
1
by: davidevan | last post by:
What I'm trying to do is set a players division according to their age. So if age is 8, update division to junior, if age is 9, update division to medium, if age is 10, update division to pee wee,...
2
by: Crash | last post by:
SQL Server 2005 SP1 Standard & Express ..NET 2.0 and ADO.NET C# Hi, I have a stored procedure that returns results from 3 select statements. When I "ExecuteDataset" from C# code the...
3
by: =?Utf-8?B?bWljaGFlbCBzb3JlbnM=?= | last post by:
I am wondering if someone could provide a code sample (or just a suggested approach) on how to fill a single DataGridView with multiple result sets. For example, this statement returns a one-line...
4
by: Cyprus106 | last post by:
Apparently, Im incapable of properly executing this query! I've been at this for far too long and gotten nowhere. Forgive me if this is a umb mistake; I'm not great at SQL. I've got three tables,...
12
by: stretchtack | last post by:
Hey Troops, I'm not sure if this is allowed, but I'm trying to keep my SP generic and reduce duplicate code. Depending on a condition, I need to JOIN to different tables, which slightly changes...
0
by: TheBlackDragon7 | last post by:
.. At least, I think that's what I'm asking for... Please bear with me as I try to explain my setup and my question. :) I have a database set up for products. each product (obviously) has a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.