Re: 2 Queries need to combine into one

2009-11-10 Thread Ananda Kumar
select * from a; +--+ | id | +--+ |1 | |2 | +--+ 2 rows in set (0.00 sec) mysql> select * from b; +--+ | id | +--+ |1 | |2 | +--+ 2 rows in set (0.00 sec) mysql> mysql> select (select id from a where id=1) + (select id from b where id=1); +-

Re: 2 Queries need to combine into one

2009-11-10 Thread Peter Brawley
Robin, << select (SELECT dealer.FIRMID, (COUNT(*) -1) * 25.00 + 270.00 AS FEE FROM `dealer` `dealer` INNER JOIN `branches` `branches` ON (`branches`.`FIRMID` = `dealer`.`FIRMID`) WHERE (( `dealer`.`CRD_NUM` = 0 ) OR ( `dealer`.`CRD_NUM` IS NULL )) AND ( `dealer`.`LIC_TYPE` IN (1

Re: 2 Queries need to combine into one

2009-11-10 Thread Robin Brady
Initially I received "the operand should only have one column" so I removed the dealer.FIRMID from the select statement and then the query just returns NULL. Each query works fine on its own but I can't seem to combine it so that is gives me the total of the fees. Robin >>> Ananda Kumar 11/10

Re: 2 Queries need to combine into one

2009-11-10 Thread Ananda Kumar
select (SELECT dealer.FIRMID, (COUNT(*) -1) * 25.00 + 270.00 AS FEE FROM `dealer` `dealer` INNER JOIN `branches` `branches` ON (`branches`.`FIRMID` = `dealer`.`FIRMID`) WHERE (( `dealer`.`CRD_NUM` = 0 ) OR ( `dealer`.`CRD_NUM` IS NULL )) AND ( `dealer`.`LIC_TYPE` IN (1,2,3,7,9