List:General Discussion« Previous MessageNext Message »
From:Joppe A Date:February 28 2005 9:44am
Subject:how can I do instead of using subselects?
View as plain text  
Hello everyone,

I have a problem with a few sql-queries because I have written the questions with
subselect statements and then will they not work on older MySQL DB:s. Can any one help me
to say haw to solve it without subselect! 

Today looks the questions like this:

SELECT (SELECT count(SUB.S_ID) FROM SUB 
  LEFT JOIN SUBS ON SUBS.S_ID = SUB.S_ID)
    /(SELECT COUNT(*) from SUB);

SELECT COUNT(SUBS.NEW_ID)+(SELECT COUNT(SUBS_D.NEW_ID)
 FROM SUBS_D WHERE
   SUBS.NEW_ID=SUBS_D.NEW_ID)
     FROM SUBS WHERE SUBS.NEW_ID=1; 

SELECT (SELECT count(*) from SUBS)-(SELECT count(SUBS.S_ID) FROM SUB LEFT JOIN SUBS ON
SUBS.S_ID = SUB.S_ID)+(SELECT count(*) FROM SUBS_D); 


Another question is how do I do when I want to compare two tables, normally is it no
problem to get a list with rows that exist i both tables, but how do I do if I want to to
have the diffrence listed instead, the rows that only appears in one of the tables?

Thanks in advance!

/Joppe


-- 
___________________________________________________________
Sign-up for Ads Free at Mail.com
http://promo.mail.com/adsfreejump.htm

Thread
how can I do instead of using subselects?Joppe A28 Feb
  • Re: how can I do instead of using subselects?Peter Brawley28 Feb