Hi, Kevin
Can you make count sub select statement to view
The view is select by year & account
decode statement for counting will be batter
Sr. ERP Analyst, Multi Platforms
"Mullins, Kevin" <[log in to unmask]> wrote in message news:<[log in to unmask]>...
> Would appreciate any help that this great list can offer...please note the
> following SQL code
>
> select
> profit_centers.pc_code,
> accounts.account_number,
> accounts.account_name,
> accounts.insurance_premium_vanline,
> y2001.y2001_count,
> y2002.y2002_count
> from accounts,
> profit_centers,
> (select count(mode_details.mode_details_number) y2001_count
> from mode_details, accounts
> where accounts.account_number = mode_details.bill_to_number
> and mode_details.date_cancelled is null
> and mode_details.mode_number = 4
> and trunc(mode_details.date_booked) between '01-JAN-2001' and
> '31-DEC-2001') Y2001,
> (select count(mode_details.mode_details_number) y2002_count
> from mode_details
> where mode_details.date_cancelled is null
> and mode_details.mode_number = 4
> and trunc(mode_details.date_booked) between '01-JAN-2002' and
> '31-DEC-2002') Y2002
>
> Now the question - how can I get the queries in the FROM clause to only
> retrieve the count based on the account number in the outermost main
> query....Oracle is the database being queried in this instance.
>
> TIA for any help anyone can offer....
>
> Regards,
> Kevin
>
> * To join/leave the list, search archives, change list settings, *
> * etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|