Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Numbering results

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-09-17 : 10:24:01
Sue writes "Using SQL Server 2000 on Windows 2000

I have 2 tables Books and Orders. Each order has a BookId. I want to display a list of top 10 most ordered books and number it according to popularity (see table below). The number is nothing you can get from the tables but something that has to be incremented in the query.

<TABLE>
<TR>
<TD>no.</TD><TD>BookID</TD><TD>Count</TD>
</TR>
<TR>
<TD>1</TD><TD>34</TD><TD>56</TD>
</TR>
<TR>
<TD>2</TD><TD>50</TD><TD>54</TD>
</TR>
<TR>
<TD>2</TD><TD>37</TD><TD>54</TD>
</TR>
<TR>
<TD>4</TD><TD>67</TD><TD>50</TD>
</TR>
</TABLE>
If the count is the same I want the no to be the same but the nr is 4 (if it is item 4) even though there is no no. 3.

The problem is that I dont know how to display this column and make these no.

Can you help me?"
   

- Advertisement -