re{ SQL Query
Posted in 1992
Topics: SQL Development & Query Writing, Connectivity: ESQL/C, 4GL & Embedded SQL
In article <8778@emory.mathcs.emory.edu> foxj@moscow.cc.bellcore.com (fox,james
p) writes:
>
> I have come across what seems like a simple problem but I can't
> think of an easy solution to it.
>
> I have a table with the following columns:
> FIELD1
> FIELD2
> FIELD3
>
> and an Ace report select of:
> SELECT UNIQUE FIELD1, FIELD2 from table;>
> Before I execute this report I would like to know how many rows
> will be selected but it seems impossible to use count as I
> cannot specify two fields on the UNIQUE. By the way I am using
> ESQL/C.
I have since lost the full blow note that you put on the net so the reply below
is based on the information above. I am assuming that you KNOW the field names
and the name of the table that you wish to get the row count from. Here is one
approach you could try. It involves setting up a view that performs the basic
SELECT that you require:
CREATE VIEW viewname AS
SELECT UNIQUE FIELD1, FIELD2, FIELD3 FROM tablename
Once you have done this you can do things like:
SELECT count(*) FROM viewname
SELECT count(*) FROM viewname WHERE .....
If this is irrelevant for what you are trying to do then ignore it.
The pleasure is all mine.
Mark Denham
Shadowfax Systems Ltd
London