Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have 12 record. i want to show Amount,date and installment no 12 times in a sequence but loan id only one time in a row. help me with this.

thanX in advance

Select c.Loan_id,i.Installment_no,i.Date,i.Amount from Customer c,Installments i,Loan l where l.Loan_id=c.Loan_id and c.Loan_id=i.Loan_id;
Posted
Updated 27-Dec-12 5:45am
v2
Comments
zeshanazam 27-Dec-12 12:24pm    
here is data



Installment_no Loan_id Date Amount
1 1234-55 2013-01-13 86688
2 1234-55 2013-02-13 86688
3 1234-55 2013-03-13 86688
4 1234-55 2013-04-13 86688
5 1234-55 2013-05-13 86688
6 1234-55 2013-06-13 86688
7 1234-55 2013-07-13 86688
8 1234-55 2013-08-13 86688
9 1234-55 2013-09-13 86688
10 1234-55 2013-10-13 86688
11 1234-55 2013-11-13 86688
12 1234-55 2013-12-13 86688
Bassofa 27-Dec-12 12:30pm    
Can you please clarify your question?
zeshanazam 27-Dec-12 12:35pm    
Value of Loan_id should appear only one time.

1 solution

zeshanazam,

Ideally, you would just limit the output in the code. But if you have to only have it output on one row, try the following. I'm assuming you're using SQL Server. Different database may change the syntax.

SQL
Select 	CASE i.Installment_no
	  WHEN 1 THEN c.Loan_id
	  ELSE null
	END AS Loan_ID
	,i.Installment_no
	,i.Date
	,i.Amount 
from Customer c
	,Installments i
	,Loan l 
where l.Loan_id = c.Loan_id 
and c.Loan_id = i.Loan_id;


Hogan
 
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