|
John,
The ON phrase goes with the LEFT OUTER JOIN clause and specifies the
conditions used to "connect" the joined database with the other databases in
the statement. I've reformatted the SQL statement below to show the
different sections more clearly.
MONO (and FREE) are parameters to the @Prompt function. From what I've read
via Google, MONO means the user selects a single value.
Hope this helps!
Richard
SELECT
count(dbo.VISIT.P_KEY),
datepart(mm,( dbo.VISIT.ARRIVALDT )),
TriageAcuityMstrLst.URGENCY
FROM
dbo.VISIT
LEFT OUTER JOIN dbo.ACUITYASSESSMENT TriageAcuityAssessment
ON TriageAcuityAssessment.VISIT_FK=dbo.VISIT.P_KEY and
TriageAcuityAssessment.Acuity_SVC_FK = '00000000000A2'
LEFT OUTER JOIN dbo.ACUITYMSTRLST TriageAcuityMstrLst
ON TriageAcuityMstrLst.P_KEY=TriageAcuityAssessment.ACUITYMSTR_FK
WHERE
( dbo.VISIT.Status_SVC_FK != '00000000001JY' and dbo.VISIT.Status_SVC_FK
!= '00000000000AQ' )
AND (
( ( dbo.VISIT.ARRIVALDT ) >= @Prompt('Select Beginning Date', 'A',, MONO,
FREE) AND ( dbo.VISIT.ARRIVALDT ) <= (@Prompt('Select Ending Date', 'A',,
MONO, FREE) + ' 23:59:59') )
)
GROUP BY
datepart(mm,( dbo.VISIT.ARRIVALDT )),
TriageAcuityMstrLst.URGENCY
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of jmmckee
Sent: Wednesday, December 16, 2009 1:13 PM
To: Midrange Systems Technical Discussion
Subject: SQL translation
I have been shown a rather complex SQL statement. My knowledge of SQL is
limited. I am attempting to translate the query to the language used by
Business Objects.
This is the SQL statement:
SELECT
count(dbo.VISIT.P_KEY),
datepart(mm,( dbo.VISIT.ARRIVALDT )),
TriageAcuityMstrLst.URGENCY
FROM
dbo.VISIT LEFT OUTER JOIN dbo.ACUITYASSESSMENT TriageAcuityAssessment ON
TriageAcuityAssessment.VISIT_FK=dbo.VISIT.P_KEY and
TriageAcuityAssessment.Acuity_SVC_FK = '00000000000A2'
LEFT OUTER JOIN dbo.ACUITYMSTRLST TriageAcuityMstrLst ON
TriageAcuityMstrLst.P_KEY=TriageAcuityAssessment.ACUITYMSTR_FK
WHERE
( dbo.VISIT.Status_SVC_FK != '00000000001JY' and dbo.VISIT.Status_SVC_FK
!= '00000000000AQ' )
AND (
( ( dbo.VISIT.ARRIVALDT ) >= @Prompt('Select Beginning Date', 'A',, MONO,
FREE) AND ( dbo.VISIT.ARRIVALDT ) <= (@Prompt('Select Ending Date', 'A',,
MONO, FREE) + ' 23:59:59') )
)
GROUP BY
datepart(mm,( dbo.VISIT.ARRIVALDT )),
TriageAcuityMstrLst.URGENCY
Questions:
1) On the FROm clause, what does the ON phrase mean? If that is part of
record selection, why isn't it on the WHERE clause?
2) On the WHERE clause what does MONO mean?
John McKee
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.