Re: SQLForms30 questions - HELP!

From: James Forgy <forgy_at_ll.mit.edu>
Date: Thu, 31 Mar 94 16:37:57 -0500
Message-ID: <9403311637.PN01027_at_LL.MIT.EDU>


In article <2nf17b$sdg_at_access1.digex.net> dzik_at_access1.digex.net (Joseph Dzikiewicz) writes:
>From: dzik_at_access1.digex.net (Joseph Dzikiewicz)
>Subject: SQLForms30 questions - HELP!
>Date: 31 Mar 1994 12:28:11 -0500
 

>I need some help with SQL*Forms30.
 

>I have an application where I want to generate a form that looks like
>the following:
 

>---------------------------------------------------------------------
>| THINGS COUNT |
>| THING1 12 |
>| THING2 8 |
>| THING3 1 |
>| |
>----------------------------------------------------------------------

>where THINGS is a specific column from a table, and COUNT is the number of
>times that a specific THING appears in the column.
 

>My problems are as follows:
 

> 1. How do I get the THINGS column to report only distinct THINGS?
>I want to do the following in an SQL query:
 

> SELECT DISTINCT THINGS FROM THING_TABLE;
 
>and have the results appear in my THINGS column, but I cannot figure
>out how to get the DISTINCT clause into the form block's query.
 

> 2. For some reason that I do not understand, when I set up a
>POST-CHANGE trigger on the THINGS block with text something like:
 

> SELECT COUNT(THINGS)
> INTO :form.Count
> FROM THING_TABLE WHERE THINGS = :form.Things;
 

>my COUNT column fills with zeros.

>Can anyone out there in net-land help me with these two problems?

If this is a query only block, which it probably is, just create a view:

create view thing_cludge
as
select thing, count(*)
from tab
group by thing

then this will be the base-table of your block.

jf Received on Thu Mar 31 1994 - 23:37:57 CEST

Original text of this message