Hello,
Using PostgreSQL 9.6.5 64bit running on Windows 10 64bit.
There are no foreign key across tables in database. There is a table where
company codes are kept. Most other tables includes company code value in a
column. Column name is same for all tables which is "fk".
Before deleting any company code row, I would like to be sure that it is not
used in anywhere. Currently I am running a separate query for each table but
that takes a lot of time and possibility to miss a table or two.
Is it possible to build a single SQL statement and include all tables in it
so that I receive single "count(fk)" sum across all tables?
Several sample SQLs run at the moment are as follows:
Select count(fk) from cari
Select count(fk) from sipbaslik
Select count(fk) from stkdepo
Select count(fk) from stkkart
Select count(fk) from stkhar
Thanks & regards,
Ertan Küçükoğlu
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql