"Martijn Tonies" <[EMAIL PROTECTED]> wrote on 02/21/2005 10:20:28 AM:

> 
> 
> > 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
> 
> This won't return the same result if there's no entries
> in "subs_erased" for the ID = 1.
> 
> With regards,
> 
> Martijn Tonies
> Database Workbench - developer tool for InterBase, Firebird, MySQL & MS 
SQL
> Server
> Upscene Productions
> http://www.upscene.com
> 
> > 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!
> >
> >
> 

It should if he changed the INNER JOIN to a LEFT JOIN.

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine

Reply via email to