List:General Discussion« Previous MessageNext Message »
From:Johan Höök Date:February 21 2005 2:57pm
Subject:Re: How to make so I only need to specify the id once..
View as plain text  
Hi,
why not try:
SELECT COUNT(s.Id)+COUNT(se.Id)
FROM subs s
INNER JOIN subs_erased se ON s.Id=se.Id
WHERE s.Id=1;

/Johan

Joppe A wrote:
> Hello,
> 
> I have a small problem that is probably easy to fix but it is to advanced for me as a
> "newbe". In my sql-query (below) have I the ID specified twice, I wonder if there is a
> easy way to solve it so I only need to write my ID once in the query?
> 
> SELECT (SELECT COUNT(*) FROM subs WHERE id=1) + (SELECT COUNT(*) FROM subs_erased
> WHERE id=1);
> 
> Thanks in advance!

Thread
How to make so I only need to specify the id once..Joppe A21 Feb
  • Re: How to make so I only need to specify the id once..Johan Höök21 Feb
  • Re: How to make so I only need to specify the id once..Martijn Tonies21 Feb
    • Re: How to make so I only need to specify the id once..Johan Höök21 Feb
    • Re: How to make so I only need to specify the id once..SGreen22 Feb