• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Fix my SQL please :)

Code:
SELECT b.Empl_Nbr, b.Qlfn_Code as MainQlfn_Code, a.Qlfn_Code as LicHistQlfnCode
FROM DVMS_Main as b
(
SELECT DVMS_LicHist.Empl_Nbr, DVMS_LicHist.Qlfn_Code, max(DVMS_LicHist.EntryDate) as Qlfn_CodeDate
FROM DVMS_LicHist
GROUP BY DVMS_LicHist.Empl_Nbr, DVMS_LicHist.Qlfn_Code
ORDER BY DVMS_LicHist.Empl_Nbr
) as a
WHERE b.Qlfn_Code <> a.Qlfn_Code
Just giving me a syntax error. Does it have to do with my aliases?
 
Last edited:
You cannot have the order by in your subquery, and you forgot a comma after b to differentiate the sources.

Code:
SELECT b.Empl_Nbr, b.Qlfn_Code as MainQlfn_Code, a.Qlfn_Code as LicHistQlfnCode
FROM DVMS_Main as b,
(
SELECT DVMS_LicHist.Empl_Nbr, DVMS_LicHist.Qlfn_Code, max(DVMS_LicHist.EntryDate) as Qlfn_CodeDate
FROM DVMS_LicHist
GROUP BY DVMS_LicHist.Empl_Nbr, DVMS_LicHist.Qlfn_Code
) as a
WHERE b.Qlfn_Code <> a.Qlfn_Code
 
Back
Top