I have an MsSQL server and what I am doing is selecting rows from the table. Currently I have two rows so I was wondering how would I check if there are no other rows after second one without making another query?
For example
table users
id name pass
1 joe 123
2 bob abc
How would I check if there is no row after 2 with just a query? I am willing to combining it with my current query, which just selects the data.
You can return the number of rows in your query as another column:
Keep in mind that this is telling you the number of rows returned by the query, not the number of rows in the table. However, if you specify a “TOP n” in your select, the rows column will give you the number of rows that would have been returned if you didn’t have “Top n”