Hi Everyone,
I have an OUTER JOIN in a query that is supposed to drop off the check number if a check has not been printed yet, but still include the voucher. The absense of the record in the AP Header table indicates that there is no check.
I had to modify the query outside of Crystal because I could not figure out how to get the selection expert to place the evaluation in the OUTER JOIN instead of the WHERE clause.
Here is the working query:
SELECT
apvohdr.trx_ctrl_num,
appyhdr."doc_ctrl_num", appyhdr."date_doc",
apvohdr."doc_ctrl_num", apvohdr."date_applied",
apvend."vendor_name",
apvodet."amt_extended",
esc_apeproj."job_phase", esc_apeproj."expense_type_code"
FROM
{ oj (((("NAIB"."dbo"."appyhdr" appyhdr INNER JOIN "NAIB"."dbo"."appydet" appydet ON
appyhdr."trx_ctrl_num" = appydet."trx_ctrl_num"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
RIGHT OUTER JOIN "NAIB"."dbo"."apvohdr" apvohdr ON
appydet."apply_to_num" = apvohdr."trx_ctrl_num"
AND appyhdr.payment_type <= 2 AND appyhdr.void_flag = 0)
INNER JOIN "NAIB"."dbo"."apvodet" apvodet ON
apvohdr."trx_ctrl_num" = apvodet."trx_ctrl_num"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
INNER JOIN "NAIB"."dbo"."apvend" apvend ON
apvohdr."vendor_code" = apvend."vendor_code"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
INNER JOIN "NAIB"."dbo"."esc_apeproj" esc_apeproj ON
apvodet."trx_ctrl_num" = esc_apeproj."trx_ctrl_num" AND
apvodet."sequence_id" = esc_apeproj."row_num"}
WHERE
apvohdr."date_applied" >= 600000 AND
apvohdr."date_applied" <= 999999
The evaluations in the WHERE clause are ok because they are part of the INNER JOIN.
Is there a way I can get Crystal (8.0) to place the evaluation in the OUTER JOIN instead of in the WHERE clause?
If not, I'll just put the query into a view or stored procedure.
Thanks,
Bontebok
I have an OUTER JOIN in a query that is supposed to drop off the check number if a check has not been printed yet, but still include the voucher. The absense of the record in the AP Header table indicates that there is no check.
I had to modify the query outside of Crystal because I could not figure out how to get the selection expert to place the evaluation in the OUTER JOIN instead of the WHERE clause.
Here is the working query:
SELECT
apvohdr.trx_ctrl_num,
appyhdr."doc_ctrl_num", appyhdr."date_doc",
apvohdr."doc_ctrl_num", apvohdr."date_applied",
apvend."vendor_name",
apvodet."amt_extended",
esc_apeproj."job_phase", esc_apeproj."expense_type_code"
FROM
{ oj (((("NAIB"."dbo"."appyhdr" appyhdr INNER JOIN "NAIB"."dbo"."appydet" appydet ON
appyhdr."trx_ctrl_num" = appydet."trx_ctrl_num"
RIGHT OUTER JOIN "NAIB"."dbo"."apvohdr" apvohdr ON
appydet."apply_to_num" = apvohdr."trx_ctrl_num"
AND appyhdr.payment_type <= 2 AND appyhdr.void_flag = 0)
INNER JOIN "NAIB"."dbo"."apvodet" apvodet ON
apvohdr."trx_ctrl_num" = apvodet."trx_ctrl_num"
INNER JOIN "NAIB"."dbo"."apvend" apvend ON
apvohdr."vendor_code" = apvend."vendor_code"
INNER JOIN "NAIB"."dbo"."esc_apeproj" esc_apeproj ON
apvodet."trx_ctrl_num" = esc_apeproj."trx_ctrl_num" AND
apvodet."sequence_id" = esc_apeproj."row_num"}
WHERE
apvohdr."date_applied" >= 600000 AND
apvohdr."date_applied" <= 999999
The evaluations in the WHERE clause are ok because they are part of the INNER JOIN.
Is there a way I can get Crystal (8.0) to place the evaluation in the OUTER JOIN instead of in the WHERE clause?
If not, I'll just put the query into a view or stored procedure.
Thanks,
Bontebok