Unix Technical Forum

Retreiving distinct rows

This is a discussion on Retreiving distinct rows within the Oracle Database forums, part of the Database Server Software category; --> A co-worker of mine is running this script. The query returns multiple rows per loan number because the SETDATA ...


Go Back   Unix Technical Forum > Database Server Software > Oracle Database

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-23-2008, 10:04 AM
Hitesh
 
Posts: n/a
Default Retreiving distinct rows

A co-worker of mine is running this script. The query returns
multiple rows per loan number because the SETDATA table can have
different values. I would like to modify the script that one row per
loan number is returned and that different SETDATA values are
displayed horizontally, not vertically. How can I approach this
problem, a decode statement? Thank you.


SELECT
T."AP_NUM",
T."LOAN_AMOUNT",
T."ADDRESS_NUM",
T."ADDRESS",
T."CITY",
T."STATE",
T."ZIP_CODE",
T."COUNTY",
T."FUNDED_DATE",
T."TD_DATE",
T."TITLE_POL_DATE",
XREF."BORR_LAST_NAME",
XREF."BORR_FIRST_NAME"
MSDATA2."RECORDING_DT",
MSDATA2."INSTRUMENT_NUM",
SETDATA."TYPE",
SETDATA."COMPANY",
SETDATA."ADDRESS",
SETDATA."CITY",
SETDATA."STATE",
SETDATA."ZIP",
SETDATA."CONTACT",
SETDATA."PHONE",
SETDATA."FAX_PHONE"

FROM
"WINRLS"."T" T,
"WINRLS"."XREF" XREF,
"WINRLS"."MSDATA2" MSDATA2,
"WINRLS"."SETDATA" SETDATA

WHERE
T."AP_NUM" = XREF."AP_NUM" (+) AND
T."AP_NUM" = MSDATA2."AP_NUM" (+) AND
T."AP_NUM" = SETDATA."AP_NUM" (+) AND
(SETDATA."TYPE" = 8 OR
SETDATA."TYPE" = 3 OR
SETDATA."TYPE" = 12) AND
T."FUNDED_DATE" < {ts '2003-06-01 00:00:00.00'}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-23-2008, 10:04 AM
Daniel Morgan
 
Posts: n/a
Default Re: Retreiving distinct rows

Hitesh wrote:

> A co-worker of mine is running this script. The query returns
> multiple rows per loan number because the SETDATA table can have
> different values. I would like to modify the script that one row per
> loan number is returned and that different SETDATA values are
> displayed horizontally, not vertically. How can I approach this
> problem, a decode statement? Thank you.
>
>
> SELECT
> T."AP_NUM",
> T."LOAN_AMOUNT",
> T."ADDRESS_NUM",
> T."ADDRESS",
> T."CITY",
> T."STATE",
> T."ZIP_CODE",
> T."COUNTY",
> T."FUNDED_DATE",
> T."TD_DATE",
> T."TITLE_POL_DATE",
> XREF."BORR_LAST_NAME",
> XREF."BORR_FIRST_NAME"
> MSDATA2."RECORDING_DT",
> MSDATA2."INSTRUMENT_NUM",
> SETDATA."TYPE",
> SETDATA."COMPANY",
> SETDATA."ADDRESS",
> SETDATA."CITY",
> SETDATA."STATE",
> SETDATA."ZIP",
> SETDATA."CONTACT",
> SETDATA."PHONE",
> SETDATA."FAX_PHONE"
>
> FROM
> "WINRLS"."T" T,
> "WINRLS"."XREF" XREF,
> "WINRLS"."MSDATA2" MSDATA2,
> "WINRLS"."SETDATA" SETDATA
>
> WHERE
> T."AP_NUM" = XREF."AP_NUM" (+) AND
> T."AP_NUM" = MSDATA2."AP_NUM" (+) AND
> T."AP_NUM" = SETDATA."AP_NUM" (+) AND
> (SETDATA."TYPE" = 8 OR
> SETDATA."TYPE" = 3 OR
> SETDATA."TYPE" = 12) AND
> T."FUNDED_DATE" < {ts '2003-06-01 00:00:00.00'}


A decode statement.

--
Daniel Morgan
http://www.outreach.washington.edu/e...ad/oad_crs.asp
http://www.outreach.washington.edu/e...oa/aoa_crs.asp
damorgan@x.washington.edu
(replace 'x' with a 'u' to reply)

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 02:00 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com