I'm working in SQL Server 2012. I have a table which contains below 2 columns
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
th, td {
padding: 15px;
}
<table style="width:100%">
<tr>
<th>ID</th>
<th>Version</th>
</tr>
<tr>
<td>1</td>
<td>0</td>
</tr>
<tr>
<td>1</td>
<td>1</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
</tr>
<tr>
<td>1</td>
<td>3</td>
</tr>
<tr>
<td>2</td>
<td>0</td>
</tr>
<tr>
<td>2</td>
<td>1</td>
</tr>
<tr>
<td>2</td>
<td>2</td>
</tr>
<tr>
<td>3</td>
<td>0</td>
</tr>
<tr>
<td>3</td>
<td>1</td>
</tr>
</table>
I want to get only the id which are having more than 2 versions and not include the latest 2 versions.
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
th, td {
padding: 15px;
}
<table style="width:100%">
<tr>
<th>Id</th>
<th>Version</th>
</tr>
<tr>
<td>1</td>
<td>0</td>
</tr>
<tr><td>1</td>
<td>1</td></tr>
<tr><td>2</td>
<td>0</td></tr>
</table>
How to write the query?
Aucun commentaire:
Enregistrer un commentaire