Click here to Skip to main content
15,920,603 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
how retrieve info from 2 tables based on composite primary key...!
The firm has a few outlets that receive items for recycling. Each of the outlets receives funds to be paid to deliverers. Information on received funds is registered in a table:

Income_o(point, date, inc)

The primary key is (point, date), thus receiption of money (inc) takes place not more than once a day (date column does not include time component of the date). Information on payments to deliverers is registered in the table:

Outcome_o(point, date, out)

In this table the primary key (point, date) also ensures bookkeeping of the funds distribution at each point not more than once a day.



Question:


Under the assumption that the income (inc) and expenses (out) of the money at each outlet are written not more than once a day, get a result set with the fields: point, date, income, expense.
Use Income_o and Outcome_o tables.

Could any one explain how to find the solution ...!
Posted
Comments
E.F. Nijboer 16-Nov-11 7:08am    
Tried anything yourself? Did you even open your school textbook?

1 solution

SQL
SELECT A.point point,A.date date,inc income,out expense 
FROM Income_o A join Outcome_o B on A.point=B.point and A.date=B.date
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900