sql question
Posted in 1993
netters,
anyone able to explain the following output - explicitely, why the third
column is always 1, but the diff column is correct?
{ get the count of number of columns for each table on host hermes1 }
select tabid,count(*) cnt
from system@hermes1:syscolumns
group by tabid
into temp h1;
{ get the count of number of columns for each table on host hermes2 }
select tabid,count(*) cnt
from system@hermes2:syscolumns
group by tabid
into temp h2;
{ display a report of each tablename, followed by the number of columns }
{ for hermes1 and hermes2, and the difference in number of columns }
select a.tabid,
a.tabname,
b.cnt,
c.cnt,
b.cnt-c.cnt diff
from system@hermes1:systables a,
h1 b,
h2 c
where a.tabid = b.tabid
and a.tabid = c.tabid;
{
SQL: New Run Modify Use-editor Output Choose Save Info Drop Exit
Run the current SQL statements.
----------------------- system ----------------- Press CTRL-W for Help --------
tabid tabname cnt cnt diff
1 systables 18 1 0
2 syscolumns 7 1 0
3 sysindexes 25 1 0
4 systabauth 4 1 0
5 syscolauth 5 1 0
6 sysviews 3 1 0
7 sysusers 4 1 0
8 sysdepend 4 1 0
9 syssynonyms 4 1 0
10 syssyntable 6 1 0
11 sysconstraints 6 1 0
12 sysreferences 7 1 0
13 syschecks 4 1 0
14 sysdefaults 4 1 0
15 syscoldepend 3 1 0
16 sysprocedures 9 1 0
17 sysprocbody 4 1 0
18 sysprocplan 7 1 0
19 sysprocauth 4 1 0
20 sysblobs 4 1 0
21 sysopclstr 36 1 0
}
regards,
+----------------------------------------------------------------------------+
| . . | |
| ... ... | Bob Baskett |
| ..... ..... | Software Engineer, DBA |
| .. ... .. | Business Systems Integration Group |
| . . . | Semiconductor Products Sector |
| | Mesa, AZ |
| Motorola, Inc. | |
|----------------------------------------------------------------------------|
| 'connectionLESS IS MORE' -- Data Broker |
|----------------------------------------------------------------------------|
| Duct tape is like the force. It has a light side, and a dark side, and |
| it holds the universe together ... |
| -- Carl Zwanzig |
+----------------------------------------------------------------------------+