I have a table Rent_Payment with subclasses checks and like_value (PK is payment_ID). Each of the subclasses have a description (ex: like_value has 'Fixed a car'). Tenant pays the Rent Payment (linked by FK tenant_ID). I want to display:
Tenant, and description from the subclass of how they paid. I unioned all the subclasses but I don't understand how to use the union and make sure that the rent_payment.te nant is the same as tenant.tenant_I D - select tenant.fn, tenant.ln, rent_payment.AMOUNT,checks.check_desc, direct_deposit.DEPOSIT_DESC, like_value.description
-
from tenant, rent_payment, checks, direct_deposit, like_value
-
where rent_payment.tenant_ID = tenant.tenant_ID AND
-
-
select rent_payment.payment_ID
-
from rent_payment, checks
-
where rent_payment.payment_ID = checks.payment_ID
-
UNION
-
select rent_payment.payment_ID
-
from rent_payment, direct_deposit
-
where rent_payment.payment_ID = direct_deposit.payment_ID
-
UNION
-
select rent_payment.payment_ID
-
from rent_payment, like_value
-
where rent_payment.payment_ID = like_value.payment_ID;
The union all works on its own and the top part (up until the AND) all works on its own too…its just how to put them together I am having an issue with.
2 1301
Sorry its my first post! Not sure how to do it!
Rabbit 12,516
Recognized Expert Moderator MVP
Instructions on how to use the forum are in the FAQ.
If you want to pull data from those 3 tables: checks, direct_deposit, like_value. Then you need to outer join to those tables.
If you don't know what an outer join is, that is explained in the SQL tutorial located here: http://www.w3schools.com/sql/sql_join_left.asp Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Tomas |
last post by:
I would like to know if and how it is possible to join the *result* of
a union with another table (without first doing individual joins to
each part of the result that then will be combined into a union) ??
For example, I would like to do such a join, if possible, to avoid
doing something like this:
select tableA.col1 as c1 , tableC.col2, tableC.col3, tableC.col4,
tableC.col5, .....
from tableA inner join tableC
on tableA.col1 =...
|
by: Paradigm |
last post by:
I am trying to make a union query to join 4 tables. I have reduced the
tables to just 5 fields and made sure that the field types and names are the
same. I keep getting an error message ODBC call failed.
I have tried various combinations of the tables and find that I can use any
2 of them but as soon as a third is included in the statement the query
fails.
Is there a limit on the number of tables in a union query.
The union query looks...
|
by: Blake Caraway |
last post by:
All,
I've seen several posts regarding using UNION or UNION ALL to mash
together two or more resultsets into a single result set, but can't
seem to find enough info here to help me answer my particular
question.
I have a stored procedure that gets the column names in a particular
format (i.e. "chassis_id"|"chassis_description"|"modify_date") as well
as actual data for a given table (in a quote-separated, pipe-delimited
|
by: Elroyskimms |
last post by:
Using SQL 2000...
tblCustomer:
CustomerID int
CompanyName varchar(20)
HasRetailStores bit
HasWholesaleStores bit
HasOtherStores bit
tblInvoiceMessages:
|
by: CrystalDBA |
last post by:
I usually design applications in SQL Server and Crystal Reports. I
now need to create a crystal report on an MS Access database.
I have two tables:
Services:
Date datetime
Entry text
Amount number
(should be 4 records)
| |
by: Eitan M |
last post by:
Hello,
How can I do outer join in ms-access database ?
Thanks :)
|
by: mlarson |
last post by:
I have one table that gets updated daily by an outside source I created
anohter table that never changes however it has some of the same data as the
first table.
Table1 - inmtinfo
IN_INMNUM
IN_NAME
IN_RACE
IN_BLDING
IN_SECTION
IN_CELLDRM
|
by: Andrew S |
last post by:
Hello Mr. Expert:
- I have 3 tables in mysql in MyISAM table format, I am using mysql4.0
on freebsd5.3
- producttbl, productdetailentbl, pricetblN
- they all have "productid" as the Primary KEY. there are less than
300,000 records in each table
- when I ran the statement
select productname from productdetailentbl left join producttbl on
productdetailentbl.productid=producttbl.productid left join pricetblN
on...
|
by: daniel aristidou |
last post by:
hi i made a union query to join about 9 tables together. however when i press run an error message apears saying that it could not find object: ".
Any way so i started again and ran it after every new table joined. and the error only occurs after the 3rd table entry. but after the third table entry is removed the error message remains and it will not run.
Does any body know why this happens. I have not even typed in any ".
Also can anyone...
|
by: rogerford |
last post by:
I have two tables tbl_Dropdownlist and tbl_ListbValues
tbl_Dropdownlist has fol. Columns.
DDLid -PK
DDLName
tbl_ListValues has fol. columns.
ListValueId
DDlid – FK
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |