Question for Progress Query Gurus

WOW...................

Michael, thank you VERY much. If you were next to me right now I'd hug you
and give you a big sloppy wet Italian kiss. :-) (Not really)

However, that's definitely worth a couple martini's at Perspectives if
you're attending. I really appreciate this.... learned something new.


THANK YOU.


Vic

-----Original Message-----
From: Michael Barry
Sent: Wednesday, January 25, 2012 4:14 PM
To: vantage@yahoogroups.com
Subject: Re: [Vantage] Question for Progress Query Gurus

SELECT c.company,c.name,c.custnum,quotecount,ordercount
FROM pub.customer c INNER JOIN
(
SELECT company,custnum,COUNT(*) AS quotecount FROM pub.quotehed GROUP BY
company,custnum
) q ON c.company = q.company AND c.custnum = q.custnum INNER JOIN
(
SELECT company,custnum,COUNT(*) AS ordercount FROM pub.orderhed GROUP BY
company,custnum
) o ON c.company = o.company AND c.custnum = o.custnum


Michael

Michael Barry
Aspacia Systems Inc
866.566.9600
312.803.0730 fax
http://www.aspacia.com/

This email, and any attachments thereto, is intended only for use by the
addressee(s) named herein and may contain legally privileged and/or
confidential information. If you are not the intended recipient of this
email, you are hereby notified that any dissemination, distribution or
copying of this email, and any attachments thereto, is strictly prohibited.
If you have received this email in error, please immediately notify me by
telephone and permanently delete the original and any copy of any email and
any printout thereof.

On Jan 25, 2012, at 7:10 AM, Vic Drecchio wrote:

> Question for Progress gurus...
>
> Is it possible to do sub queries in select statements in Progress?
>
> Simple example but, in SQL, this is a valid query:
>
> SELECT
> C.CUSTOMER,
> C.CUSTNUM,
> (SELECT COUNT(*) FROM QUOTEHED Q WHERE Q.CUSTNUM = C.CUSTNUM) AS
> ‘QUOTE_COUNT’,
> (SELECT COUNT(*) FROM ORDERHED O WHERE O.CUSTUM = C.CUSTNUM) AS
> ‘ORDER_COUNT’
> FROM CUSTOMER C
>
> How do I accomplish this in Progress? Is it possible?
>
> [Non-text portions of this message have been removed]
>
>



[Non-text portions of this message have been removed]



------------------------------------

Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have
already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and
Crystal Reports and other 'goodies', please goto:
http://groups.yahoo.com/group/vantage/files/.
(2) To search through old msg's goto:
http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto:
http://groups.yahoo.com/group/vantage/linksYahoo! Groups Links





-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.1901 / Virus Database: 2109/4765 - Release Date: 01/25/12
Question for Progress gurus...

Is it possible to do sub queries in select statements in Progress?

Simple example but, in SQL, this is a valid query:

SELECT
C.CUSTOMER,
C.CUSTNUM,
(SELECT COUNT(*) FROM QUOTEHED Q WHERE Q.CUSTNUM = C.CUSTNUM) AS ‘QUOTE_COUNT’,
(SELECT COUNT(*) FROM ORDERHED O WHERE O.CUSTUM = C.CUSTNUM) AS ‘ORDER_COUNT’
FROM CUSTOMER C

How do I accomplish this in Progress? Is it possible?

[Non-text portions of this message have been removed]
Vic- have you set up a linked server so that you can query your Progress database using SQL? If you aren't a Progress expert but have a Progress db, this is the easiest way to query the database....presuming of course you DO know SQL, just a guess.

Aimee Grebe
Manager of Enterprise Resources
TIMCO Aerosystems

--- In vantage@yahoogroups.com, "Vic Drecchio" <vic.drecchio@...> wrote:
>
> Question for Progress gurus...
>
> Is it possible to do sub queries in select statements in Progress?
>
> Simple example but, in SQL, this is a valid query:
>
> SELECT
> C.CUSTOMER,
> C.CUSTNUM,
> (SELECT COUNT(*) FROM QUOTEHED Q WHERE Q.CUSTNUM = C.CUSTNUM) AS ‘QUOTE_COUNT’,
> (SELECT COUNT(*) FROM ORDERHED O WHERE O.CUSTUM = C.CUSTNUM) AS ‘ORDER_COUNT’
> FROM CUSTOMER C
>
> How do I accomplish this in Progress? Is it possible?
>
> [Non-text portions of this message have been removed]
>
That's tricky but i can be done I'll see if John (Waffqle) is around he's
done that before and he will know how



*Jose C Gomez*
*Software Engineer*
*
*
*checkout my new blog <http://www.usdoingstuff.com> *
*
*T: 904.469.1524 mobile
E: jose@...
http://www.josecgomez.com
<http://www.linkedin.com/in/josecgomez> <http://www.facebook.com/josegomez>
<http://www.google.com/profiles/jose.gomez> <http://www.twitter.com/joc85>
<http://www.josecgomez.com/professional-resume/>
<http://www.josecgomez.com/feed/>
<http://www.usdoingstuff.com>

*Quis custodiet ipsos custodes?*



On Wed, Jan 25, 2012 at 10:10 AM, Vic Drecchio
<vic.drecchio@...>wrote:

> **
>
>
> Question for Progress gurus...
>
> Is it possible to do sub queries in select statements in Progress?
>
> Simple example but, in SQL, this is a valid query:
>
> SELECT
> C.CUSTOMER,
> C.CUSTNUM,
> (SELECT COUNT(*) FROM QUOTEHED Q WHERE Q.CUSTNUM = C.CUSTNUM) AS
> �QUOTE_COUNT�,
> (SELECT COUNT(*) FROM ORDERHED O WHERE O.CUSTUM = C.CUSTNUM) AS
> �ORDER_COUNT�
> FROM CUSTOMER C
>
> How do I accomplish this in Progress? Is it possible?
>
> [Non-text portions of this message have been removed]
>
>
>


[Non-text portions of this message have been removed]
Hmph..... yeah... thanks. Tried that and also Squirrel with the native Openedge Java drivers. The more digging I’ve done in the past hour tells me that this is simply NOT something that Progress is capable of. Period.

The only way I can think to do this is exporting the data from Progress and importing into SQL and then do what I need from there. Seems like a PITA to have to do all of that, though.

Just one more reason to hate Progress.

From: aimee.grebe
Sent: Wednesday, January 25, 2012 11:05 AM
To: vantage@yahoogroups.com
Subject: [Vantage] Re: Question for Progress Query Gurus


Vic- have you set up a linked server so that you can query your Progress database using SQL? If you aren't a Progress expert but have a Progress db, this is the easiest way to query the database....presuming of course you DO know SQL, just a guess.

Aimee Grebe
Manager of Enterprise Resources
TIMCO Aerosystems

--- In mailto:vantage%40yahoogroups.com, "Vic Drecchio" <vic.drecchio@...> wrote:
>
> Question for Progress gurus...
>
> Is it possible to do sub queries in select statements in Progress?
>
> Simple example but, in SQL, this is a valid query:
>
> SELECT
> C.CUSTOMER,
> C.CUSTNUM,
> (SELECT COUNT(*) FROM QUOTEHED Q WHERE Q.CUSTNUM = C.CUSTNUM) AS ‘QUOTE_COUNT’,
> (SELECT COUNT(*) FROM ORDERHED O WHERE O.CUSTUM = C.CUSTNUM) AS ‘ORDER_COUNT’
> FROM CUSTOMER C
>
> How do I accomplish this in Progress? Is it possible?
>
> [Non-text portions of this message have been removed]
>




No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.1901 / Virus Database: 2109/4765 - Release Date: 01/25/12


[Non-text portions of this message have been removed]
Not sure what your output is, but you could just do the query in SQL with a linked server and the Merant driver. When I worked with a Progress database, I never had to write anything in 4GL (except for .p programs for global alerts). Just an idea....sorry couldn't be more helpful. Gotta love working on a Progress system. ;-)

--- In vantage@yahoogroups.com, "Vic Drecchio" <vic.drecchio@...> wrote:
>
> Hmph..... yeah... thanks. Tried that and also Squirrel with the native Openedge Java drivers. The more digging I’ve done in the past hour tells me that this is simply NOT something that Progress is capable of. Period.
>
> The only way I can think to do this is exporting the data from Progress and importing into SQL and then do what I need from there. Seems like a PITA to have to do all of that, though.
>
> Just one more reason to hate Progress.
>
> From: aimee.grebe
> Sent: Wednesday, January 25, 2012 11:05 AM
> To: vantage@yahoogroups.com
> Subject: [Vantage] Re: Question for Progress Query Gurus
>
>
> Vic- have you set up a linked server so that you can query your Progress database using SQL? If you aren't a Progress expert but have a Progress db, this is the easiest way to query the database....presuming of course you DO know SQL, just a guess.
>
> Aimee Grebe
> Manager of Enterprise Resources
> TIMCO Aerosystems
>
> --- In mailto:vantage%40yahoogroups.com, "Vic Drecchio" <vic.drecchio@> wrote:
> >
> > Question for Progress gurus...
> >
> > Is it possible to do sub queries in select statements in Progress?
> >
> > Simple example but, in SQL, this is a valid query:
> >
> > SELECT
> > C.CUSTOMER,
> > C.CUSTNUM,
> > (SELECT COUNT(*) FROM QUOTEHED Q WHERE Q.CUSTNUM = C.CUSTNUM) AS ‘QUOTE_COUNT’,
> > (SELECT COUNT(*) FROM ORDERHED O WHERE O.CUSTUM = C.CUSTNUM) AS ‘ORDER_COUNT’
> > FROM CUSTOMER C
> >
> > How do I accomplish this in Progress? Is it possible?
> >
> > [Non-text portions of this message have been removed]
> >
>
>
>
>
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 2012.0.1901 / Virus Database: 2109/4765 - Release Date: 01/25/12
>
>
> [Non-text portions of this message have been removed]
>
SELECT c.company,c.name,c.custnum,quotecount,ordercount
FROM pub.customer c INNER JOIN
(
SELECT company,custnum,COUNT(*) AS quotecount FROM pub.quotehed GROUP BY company,custnum
) q ON c.company = q.company AND c.custnum = q.custnum INNER JOIN
(
SELECT company,custnum,COUNT(*) AS ordercount FROM pub.orderhed GROUP BY company,custnum
) o ON c.company = o.company AND c.custnum = o.custnum


Michael

Michael Barry
Aspacia Systems Inc
866.566.9600
312.803.0730 fax
http://www.aspacia.com/

This email, and any attachments thereto, is intended only for use by the addressee(s) named herein and may contain legally privileged and/or confidential information. If you are not the intended recipient of this email, you are hereby notified that any dissemination, distribution or copying of this email, and any attachments thereto, is strictly prohibited. If you have received this email in error, please immediately notify me by telephone and permanently delete the original and any copy of any email and any printout thereof.

On Jan 25, 2012, at 7:10 AM, Vic Drecchio wrote:

> Question for Progress gurus...
>
> Is it possible to do sub queries in select statements in Progress?
>
> Simple example but, in SQL, this is a valid query:
>
> SELECT
> C.CUSTOMER,
> C.CUSTNUM,
> (SELECT COUNT(*) FROM QUOTEHED Q WHERE Q.CUSTNUM = C.CUSTNUM) AS �QUOTE_COUNT�,
> (SELECT COUNT(*) FROM ORDERHED O WHERE O.CUSTUM = C.CUSTNUM) AS �ORDER_COUNT�
> FROM CUSTOMER C
>
> How do I accomplish this in Progress? Is it possible?
>
> [Non-text portions of this message have been removed]
>
>



[Non-text portions of this message have been removed]