|
The following statement should work:
select distinct a.fld2, b.fld3, c.fld3, d.fld3
from datatable a left join
table b on a.fld2 = b.fld2 and b.fld1 = 'VES1'
left join datatable c on a.fld2 = c.fld2 and c.fld1 = 'VES2'
left join datatable d on a.fld2 = d.fld2 and d.fld1 = 'VES3'
order by a.fld2
Mattias
P.Goovaerts@Clipper.Be
Sent by: java400-l-admin@midrange.com
23.04.02 15:41
Please respond to java400-l
To: java400-l@midrange.com
cc:
Subject: SQL question
This is a multipart message in MIME format.
--
[ Picked text/plain from multipart/alternative ]
Suppose we have folling data-table:
fld1 fld2 fld3
VES1 BEANT 13/05/2002
VES1 DEBRE 15/05/2002
VES1 DEHAM 16/05/2002
VES2 BEANT 15/05/2002
VES2 DEBRE 17/05/2002
VES2 DEHAM 18/05/2002
VES3 BEANT 17/05/2002
VES3 DEHAM 19/05/2002
Now we want following result, using SQL
VES1 VES2 VES3
BEANT 13/05/2002 15/05/2002 17/05/2002
DEBRE 15/05/2002 17/05/2002 ---
DEHAM 16/05/2002 18/05/2002 19/05/2002
Is this possible?
Patrick Goovaerts
ICT/Clipper Support nv
www.conti7.be
_______________________________________________
This is the Java Programming on and around the iSeries / AS400 (JAVA400-L)
mailing list
To post a message email: JAVA400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/java400-l
or email: JAVA400-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/java400-l.
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.