Advanced SQL statements writing

From: Phper <>
Date: Thu, 16 Apr 2009 07:11:21 -0700 (PDT)
Message-ID: <>

I wrote this SQL statement:

FROM ((SELECT piecework_id,1+count(*)
FROM view
GROUP BY piecework_id) AS view1
(SELECT piecework_id, sum(status)
FROM submission
GROUP BY piecework_id) AS submission1
on view1.piecework_id=submission1.piecework_id);

It can be executed successfully.
This is the result.

piecework_id 	1+count(*) 	piecework_id 	sum(status)
8 	                      2   	           8	                  NULL
989 	                      2 	           NULL 	           NULL

But I want the result to be
piecework_id 	1+count(*) 	sum(status)
8 	                      2   	         NULL
989 	                      2 	         NULL

How can I achieve this? Received on Thu Apr 16 2009 - 09:11:21 CDT

Original text of this message