×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
I have an SQL doing an inner join between two tables.
The results have two rows for some employees, due to one table having two
'active' rows for that employee.
How can I write my SQL to only have one row for that employee?
This is my SQL.
SELECT em.*
FROM qs36f.v@ep_0 as ep
inner join qs36f.v@em_0 as em
on em.client = ep.client and em.rnum = ep.rnum and
em.enum = ep.employee#
where (ep.epstop = *0* or ep.epstop > *to_char*(*current_date*, 'yyyymmdd'
))
and ((em.eterm = *0* or em.eterm > *to_char*(*current_date*, 'yyyymmdd'
)) and em.empsts not in ('T'))
and (ep.eact1 = 'Y' or ep.eact2 = 'Y' or ep.eact3 = 'Y' or ep.eact4 =
'Y' or ep.eact5 = 'Y' or ep.eact6 = 'Y' or ep.eact7 = 'Y' or ep.eact8 = 'Y'
)
and ((ep.stp81 = *0* or ep.stp81 > *to_char*(*current_date*, 'yyyymmdd'
)) or
(ep.stp82 = *0* or ep.stp82 > *to_char*(*current_date*, 'yyyymmdd'
)) or
(ep.stp83 = *0* or ep.stp83 > *to_char*(*current_date*, 'yyyymmdd'
)) or
(ep.stp84 = *0* or ep.stp84 > *to_char*(*current_date*, 'yyyymmdd'
)) or
(ep.stp85 = *0* or ep.stp85 > *to_char*(*current_date*, 'yyyymmdd'
)) or
(ep.stp86 = *0* or ep.stp86 > *to_char*(*current_date*, 'yyyymmdd'
)) or
(ep.stp87 = *0* or ep.stp87 > *to_char*(*current_date*, 'yyyymmdd'
)) or
(ep.stp88 = *0* or ep.stp88 > *to_char*(*current_date*, 'yyyymmdd'
)))
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.