Focal Point
[CLOSED] Please help on SQL

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/159105061

June 23, 2009, 03:51 PM
Kulot
[CLOSED] Please help on SQL
Using SQL 2000:

Still new to SQL.
Not quite sure how to code for the target table:

SOURCE:
S1 S2 S3
--------------------
a 20090104
a keep 20090111
a 20090118
b 20090301
b 20090308
c keep 20090607
d keep 20090405
d 20090412

TARGET:
T1 T3
--------------
a 20090104
c 20090607
d 20090405

If a record in the SOURCE table exists with an S2 value of "keep", it should appear in TARGET table with a T3 value of the first S3 record in the SOURCE table.

I thought it was simple at first, but somehow, I just couldn't find a way to do it either with multiple SELECT statements or using a CURSOR.

Thanks in advance for helping!

This message has been edited. Last edited by: Kerry,


WF767, WinServ2003, SQLServ2000
HTML
June 23, 2009, 03:54 PM
Kulot
Let me fix the way those table look:

SOURCE:
S1 S2 S3
----------------
a_______20090104
a__keep_20090111
a_______20090118
b_______20090301
b_______20090308
c__keep_20090607
d__keep_20090405
d_______20090412

TARGET:
T1 T3
-----------
a__20090104
c__20090607
d__20090405


WF767, WinServ2003, SQLServ2000
HTML
June 23, 2009, 04:51 PM
Darin Lee
So what is your WebFOCUS question? If this relates to Data Migrator, you might try the iWay forum instead.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
June 23, 2009, 05:12 PM
Kulot
Sorry no WebFOCUS question. The TARGET table feeds the WebFOCUS report I am working on. I'll go to a SQL forum to find help. Thanks!


WF767, WinServ2003, SQLServ2000
HTML