Reputation: 1
I have two tables tblCustBilIinfo
with
(Bill_no,Customer_Name,date,bill_Amount,deposit,Balance)
And tblincome with (Tid,date,name,amount)
Now I need to show record like this
Select c.Bill_Amount,I.Amount ,C.balance from tblcustBillInfo as C, tblincome As I
where C.customer_Name ='rakesh'
and date between '24-06-2016' And '30-06-2016'
Now selected record is like in Balance sheet format Like in accounting (debit credit.) First Select Bill_ amount then debit amount of customer.
And also need to select date column but it values is selected from above tables on the bases of selected record.
Please can any one Help me to solve. Or guide me to use procedure or function to achieve that task.
Upvotes: 0
Views: 206
Reputation: 77876
NO, you can't get data from both table like that unless doing a JOIN
between the tables either with a related column (OR) using a common naming column.Some thing like
select c.Bill_Amount,
I.Amount ,
C.balance
from tblcustBillInfo as C JOIN tblincome As I ON C.id = I.Tid
where C.customer_Name = 'rakesh'
and C.date between '24-06-2016' And '30-06-2016'
Upvotes: 1