If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Access > Two tables, want to run query to join them

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-18-12, 12:52
grooner10 grooner10 is offline
Registered User
 
Join Date: Sep 2011
Posts: 45
Two tables, want to run query to join them

Alright,

I have two tables one having first year premiums, and the other renewal premiums.

They both are sorted by bulkid which is common between them.

I want to run a query so i can get all the information from each table in one, but I can't run a union query as the table with first year premiums has less rows because not ever bulkid has first year premiums. Is it possible to make a query so that for bulkid's that don't have first year premiums it just shows up as zero?

thanks,
Reply With Quote
  #2 (permalink)  
Old 01-18-12, 13:19
healdem healdem is online now
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,250
show us the table design
but in theory its going tobe something like

select my, column, list from mytable
join myothertable on myothertable.thatcolumn = mytable.thiscolumn
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #3 (permalink)  
Old 01-18-12, 13:26
Sinndho Sinndho is offline
Registered User
 
Join Date: Mar 2009
Posts: 3,446
You can perform a UNION operation on two SELECT queries, one of them having a constant.

- Table1 has 6 columns: Col1, Col2, Col3, Col4, Col5, Col6
- Table2 has 5 columns: Col1, Col2, Col3, Col4, Col6
- Its possible to write a query such as:

Code:
SELECT Col1, Col2, Col3, Col4, Col5, Col6
  FROM Table1
UNION
SELECT Col1, Col2, Col3, Col4, 0, Col6
  FROM Table2
__________________
Have a nice day!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On