MySQL Forums
Forum List  »  Newbie

Select Sum(~~~), Sum(~~~) Error. :(
Posted by: Seung Ju Lee
Date: July 22, 2016 12:57AM

--
Before I start, query I'll ask is SQLite query. I know here is MySQL forum but I really want to solve my problem.. Please help me. :'-(
--


I want to select two columns about sum result. So I use this query.

SELECT
SUM(a) FROM TABLE1 WHERE (CAST(b as INTEGER) = 100) AND (num = 1),
SUM(a) FROM TABLE1 WHERE (CAST(b as INTEGER) = 100) AND (num = 2)

As you see, I want to know about sum's result of different condition in one row.

One condition is num = 1, another is num = 2.

But, this occurred syntax error near ','



When I use query this,

SELECT
SUM(a) FROM TABLE1 WHERE (CAST(b as INTEGER) = 100) AND (num = 1)

it did not occur error, but above column occurred error..



How I fix this problem? Please help me. Thank you very much.

Options: ReplyQuote


Subject
Written By
Posted
Select Sum(~~~), Sum(~~~) Error. :(
July 22, 2016 12:57AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.