I have a three table one for applications to get the ID and one for applicantInfo and one for address i need to create a view that will show me the data of each column but with a condition that one row for each application and the addresses need it be beside of themselves. i make this Select Query:
Select dbo.Application.ApplicationID, dbo.ApplicantInfo.FirstName,dbo.ApplicantInfo.LastName,
dbo.Address.AddressID,dbo.Address.City
from dbo.Application LEFT JOIN
dbo.ApplicantInfo on dbo.Application.ApplicationID = dbo.ApplicantInfo.ApplicationID
LEFT JOIN
dbo.Address ON dbo.Application.ApplicationID = dbo.Address.ApplicationID
the output getting like this:
<
<table style="width:100%">
<tr>
<th>ApplicationID</th>
<th>FirstName</th>
<th>LastName</th>
<th>AddressID</th>
<th>City</th>
</tr>
<tr>
<td>1</td>
<td>John</td>
<td>Zak</td>
<th>1</th>
<th>C1</th>
</tr>
<tr>
<td>1</td>
<td>John</td>
<td>Zak</td>
<th>2</th>
<th>C2</th>
</tr>
<tr>
<td>1</td>
<td>John</td>
<td>Zak</td>
<th>3</th>
<th>C3</th>
</tr>
<tr>
<td>1</td>
<td>John</td>
<td>Zak</td>
<th>4</th>
<th>C4</th>
</tr>
</table>
but i need the output like this :
<table style="width:100%">
<tr>
<th>ApplicationID</th>
<th>FirstName</th>
<th>LastName</th>
<th>AddressID1</th>
<th>City1</th>
<th>AddressID2</th>
<th>City2</th>
<th>AddressID3</th>
<th>City3</th>
<th>AddressID4</th>
<th>City4</th>
</tr>
<tr>
<td>1</td>
<td>John</td>
<td>Zak</td>
<td>A1</td>
<td>C1</td>
<td>A2</td>
<td>C2</td>
<td>A3</td>
<td>C3</td>
<td>4</td>
<td>C4</td>
</tr>
</table>