Home » SQL & PL/SQL » SQL & PL/SQL » How to minus rows where the site id is blank from the total records between a from and to date.
How to minus rows where the site id is blank from the total records between a from and to date. [message #207720] Wed, 06 December 2006 14:52 Go to next message
jonathan184
Messages: 21
Registered: November 2006
Junior Member

How to minus rows where the site id is blank from the total records between a from and to date.

select count(*) from site s 
           where s.sitename = "" 



What should i do to get the count where the sitename with a record minus from a sitename without a record to give a count.
Re: How to minus rows where the site id is blank from the total records between a from and to date. [message #207721 is a reply to message #207720] Wed, 06 December 2006 15:09 Go to previous messageGo to next message
Littlefoot
Messages: 20900
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I'm sorry, but I can't imagine what you are talking about. You mentioned "from date" and "to date", "blank site id" (do you mean SITE_ID IS NULL?), sample code doesn't have much in common with what you've said so *perhaps* this *might* look like something you're looking for:
SELECT x.is_null - y.is_not_null
FROM (SELECT COUNT(*) is_null 
      FROM EMP WHERE mgr IS NOT NULL) x,
     (SELECT COUNT(*) is_not_null
      FROM EMP WHERE mgr IS NULL) y
;
Re: How to minus rows where the site id is blank from the total records between a from and to date. [message #207722 is a reply to message #207721] Wed, 06 December 2006 15:11 Go to previous messageGo to next message
jonathan184
Messages: 21
Registered: November 2006
Junior Member

What you have there makes sense i was trying to explain what i was trying to do i did not know i could use null.

thanks you gave me the idea on how to solve the problem
Re: How to minus rows where the site id is blank from the total records between a from and to date. [message #207723 is a reply to message #207722] Wed, 06 December 2006 15:15 Go to previous messageGo to next message
Littlefoot
Messages: 20900
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Well, if NULL was the word, great!
icon10.gif  Re: How to minus rows where the site id is blank from the total records between a from and to date. [message #207724 is a reply to message #207723] Wed, 06 December 2006 15:17 Go to previous message
jonathan184
Messages: 21
Registered: November 2006
Junior Member

Yeah sorry about that still learning but yeah null was the word Razz

Thanks
Previous Topic: urgent help needed in the query
Next Topic: how to make stored procedures in ORACLE
Goto Forum:
  


Current Time: Thu Dec 08 03:53:36 CST 2016

Total time taken to generate the page: 0.14111 seconds