LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-08-2012, 04:33 AM   #16
Harish sharma
LQ Newbie
 
Registered: Nov 2012
Posts: 12

Original Poster
Rep: Reputation: Disabled
Unhappy


Quote:
Originally Posted by chrism01 View Post
Show your real query..

In any case, you'll need to convert the NULL into zero if you want to do arithmetic on it.
(see my point 2. above)

Try IFNULL() as demonstrated here http://stackoverflow.com/questions/1...ting-null-to-0

You really need to bookmark and read https://dev.mysql.com/doc/refman/5.1/en/
Hi ,

subscription=$(mysql -D $DBDATABASE -u $DBUSER -p$DBPASSWORD -e "select sum(price) from price");
renew=$(mysql -D $DBDATABASE -u $DBUSER -p$DBPASSWORD -e "select sum(price) from boxprice");

this subcription query giving me null response and renew query giving 50 and want to sum these and want result 50..
Hope u will understand my query..

Thanx a lot
 
Old 11-08-2012, 04:40 AM   #17
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,300

Rep: Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358
There's no point in repeating your qn.
Read my answer; read those links

(Please)

Last edited by chrism01; 11-08-2012 at 04:49 AM.
 
Old 11-08-2012, 05:53 AM   #18
Harish sharma
LQ Newbie
 
Registered: Nov 2012
Posts: 12

Original Poster
Rep: Reputation: Disabled
Smile

Quote:
Originally Posted by chrism01 View Post
Show your real query..

In any case, you'll need to convert the NULL into zero if you want to do arithmetic on it.
(see my point 2. above)

Try IFNULL() as demonstrated here http://stackoverflow.com/questions/1...ting-null-to-0

You really need to bookmark and read https://dev.mysql.com/doc/refman/5.1/en/
Hi chrism01,
it's working i was in wrong direction...

I checked null in query after that results 0 than I able to sum these variable..
Thanx Again
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Errors executing shell script: "command not found" and "no such file or directory" eko000 Linux - Newbie 1 01-14-2011 07:54 AM
LFS6.3 livecd "ls : command not found" error after "su - lfs" rotu Linux From Scratch 2 06-19-2008 03:59 PM
Standard commands give "-bash: open: command not found" even in "su -" and "su root" mibo12 Linux - General 4 11-11-2007 10:18 PM
Shell Script: Find "Word" Run "Command" granatica Linux - Software 5 07-25-2007 07:42 AM
Shell: command not found / Runs fine with "Run command" badbunny Linux - Newbie 1 01-22-2007 01:21 AM


All times are GMT -5. The time now is 05:01 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration