dbTalk Databases Forums  

SQL include tablename in answer

comp.databases.paradox comp.databases.paradox


Discuss SQL include tablename in answer in the comp.databases.paradox forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Titian
 
Posts: n/a

Default SQL include tablename in answer - 08-21-2006 , 07:44 PM






Hi

I am trying to count number so records in a group of tables. I need the
answer.db to include the name of the table and the number of records in
that table.

I use:

SELECT COUNT (*)
FROM "Table1.DB"
UNION SELECT COUNT (*)
FROM "Table2.DB"

what syntax do I need to include to get the tablename?

thanks
Dan


Reply With Quote
  #2  
Old   
Larry DiGiovanni
 
Posts: n/a

Default Re: SQL include tablename in answer - 08-21-2006 , 09:24 PM






Titian wrote:

Quote:
what syntax do I need to include to get the tablename?
SELECT "table1" tablename, COUNT(*)
FROM "table1.db"
UNION ALL
SELECT "table2" tablename, COUNT (*)
FROM "Table2.DB"

etc. Obviously, if there are many tables, there are enumeration methods
that can be used to automate the generation of the string that will be the
SQL statement.

--
Larry DiGiovanni
Digico, Inc.
IT Consulting and Staffing Solutions
www.digicoinc.com
Check out www.thedbcommunity.com for Paradox resources.



Reply With Quote
  #3  
Old   
Titian
 
Posts: n/a

Default Re: SQL include tablename in answer - 08-21-2006 , 09:34 PM



Thanks for the quick response,

I knew the MS Access sql version, and that the Paradox would be
similar!

appreciate your help.

Dan

Larry DiGiovanni wrote:

Quote:
Titian wrote:

what syntax do I need to include to get the tablename?

SELECT "table1" tablename, COUNT(*)
FROM "table1.db"
UNION ALL
SELECT "table2" tablename, COUNT (*)
FROM "Table2.DB"

etc. Obviously, if there are many tables, there are enumeration methods
that can be used to automate the generation of the string that will be the
SQL statement.

--
Larry DiGiovanni
Digico, Inc.
IT Consulting and Staffing Solutions
www.digicoinc.com
Check out www.thedbcommunity.com for Paradox resources.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.