Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7813407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T04:51:07+00:00 2026-06-02T04:51:07+00:00

I have an MsSQL server and what I am doing is selecting rows from

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T04:51:08+00:00Added an answer on June 2, 2026 at 4:51 am

    You can return the number of rows in your query as another column:

    SELECT id, name, pass, count(*) over () as rows
    FROM users
    

    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”

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables and I need to remove rows from the first table
I have a table with ~100 columns, about ~30M rows, on MSSQL server 2005.
I have the problem, that MSSQL Server 2000 should select some distinct values from
I have a stored procedure which when i call from MSSQL Server GUI.It returns
my MySQL Server (version: 5.0.51a-3ubuntu5.8) I have the following InnoDB table: CREATE TABLE `kontostaende`
I have MSSQL 2008 database, which is hosted on a server. The database have
I have successfully setup my MySQL server to support SSL connections I'm just wondering
I need to have two databases placed on the same mysql server synchronised. This
I have a table with primary key in my MS SQL Server 2005 table.
I have created a table (MySQL 5.1) from sqlalchemy import * def get(): db

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.