Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Database & SysAdmin
  3. Database
  4. how to get recordno??

how to get recordno??

Scheduled Pinned Locked Moved Database
tutorialquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    biswa47
    wrote on last edited by
    #1

    i have table named emp where the coloumns are A AND B. The date in my table emp are A B ---------- 12 0 13 0 0 17 9 0 0 11 0 8 76 0 NOW I want to count the total no of records IN THE TABLE ,no of records (where A !=0 AND B=0 it means value of coloumn A not equal to '0' and value of cpoloumn B equal to zero) AND NO OF RECORDS (where A =0 AND B!=0) thanks in advance

    J 1 Reply Last reply
    0
    • B biswa47

      i have table named emp where the coloumns are A AND B. The date in my table emp are A B ---------- 12 0 13 0 0 17 9 0 0 11 0 8 76 0 NOW I want to count the total no of records IN THE TABLE ,no of records (where A !=0 AND B=0 it means value of coloumn A not equal to '0' and value of cpoloumn B equal to zero) AND NO OF RECORDS (where A =0 AND B!=0) thanks in advance

      J Offline
      J Offline
      Joe 2
      wrote on last edited by
      #2

      Assuming that you are working with Sql Server:

      biswa47 wrote:

      (where A !=0 AND B=0

      The outer query fetches the number of rows in A that are not equal to zero and the inner query fetches the number of rows in B that are equal to Zero.

      Select Count(*) [A Not Eq 0],
      (Select Count(*) From Emp Where B = 0 ) As [B Eq 0]
      From Emp Where A <> 0

      The same works the other way around, you'll have to change the operator.

      biswa47 wrote:

      where A =0 AND B!=0)

      Select Count(*) [A Eq 0],
      (Select Count(*) From Emp Where B <> 0 ) As [B Not Eq 0]
      From Emp Where A = 0

      modified on Wednesday, January 16, 2008 10:31:11 AM

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups