Jan 8, 2003 #1 nkm Programmer May 27, 2001 45 US Hi Can we write a SQL which gives the sum of the counts of 2 individual tables combined with a union clause Basically select count(*) from tmp union all select count(*) from tmp1 This will return 2 rows I want the sum of the values of the two rows. regards
Hi Can we write a SQL which gives the sum of the counts of 2 individual tables combined with a union clause Basically select count(*) from tmp union all select count(*) from tmp1 This will return 2 rows I want the sum of the values of the two rows. regards
Jan 8, 2003 #2 olded Programmer Oct 27, 1998 1,065 US Hi: One possible solution is to select into a temp table and then count the rows in the temp: select cols from tmp union all select cols from tmp1 into temp c; select count(*) from c; drop table c; "cols" is a column in the two tables tmp and tmp1. Informix does NOT allow this: select count(*) from tmp union all select count(*) from tmp1 into temp c; Regards, Ed Upvote 0 Downvote
Hi: One possible solution is to select into a temp table and then count the rows in the temp: select cols from tmp union all select cols from tmp1 into temp c; select count(*) from c; drop table c; "cols" is a column in the two tables tmp and tmp1. Informix does NOT allow this: select count(*) from tmp union all select count(*) from tmp1 into temp c; Regards, Ed
Jan 9, 2003 #3 schillache Programmer Apr 5, 2001 8 SG select count(*) from c; OR select sum(cols) from c; Plz advice rgds Schill Upvote 0 Downvote
Jan 9, 2003 #4 olded Programmer Oct 27, 1998 1,065 US Hi: I interpret the question to be "how many rows", so it's select count(*) from c Regards, Ed Upvote 0 Downvote
Hi: I interpret the question to be "how many rows", so it's select count(*) from c Regards, Ed