Hi Martijn, yes of course you're right but SELECT COUNT(s.Id)+ (SELECT COUNT(se.Id) FROM subs_erased se WHERE s.Id=se.Id) FROM subs s WHERE s.Id=1 might work, at least in 4.1.x. I did test it with 4.1.9.
/Johan
Martijn Tonies wrote:
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!
---------------------------------------------------------------------------- ----
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]