Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 14th, 2005, 04:22 PM
lucidspoon lucidspoon is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Location: Greencastle, IN
Posts: 6 lucidspoon User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 38 m 14 sec
Reputation Power: 0
Problem Selecting from View

I have a view that uses select statements to populate a few of the fields. I can select all of the data just fine normally, but there seems to be a problem when I try to select one of the fields created by the sub-select statements more than once in the same SQL statement. The other strange thing about it is that it works fine if I'm select from just the view by itself or joined with one or two other tables, but not with the four that I'm trying to join on.

For example,
Code:
SELECT z.spouse_personid, z.spouse_personid
FROM xxdv_personmaster_v z
works fine, but after I add on the other tables that I want to join with it, it stops working, unless I only have 1 "spouse_personid". The fields from the view that aren't created from sub-selects work just fine multiple times.

I need to have this field selected multiple times to be able to put it in 4 different functions in the same SQL statement, but only one function works at a time. Each function returns almost instantaneously by itself, but any two or more just hang indefinitely.

A quick fix that I used was to put this in for each function:
Code:
(SELECT z2.spouse_personid
FROM xxdv_personmaster_v z2
WHERE z2.person_id = z.person_id)
That seems to work and do it quickly, but I feel like there should be a better way.

Anybody else had any similar problems?

Thanks

Reply With Quote
  #2  
Old July 15th, 2005, 06:48 PM
michaeljshannon michaeljshannon is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 26 michaeljshannon User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 h 38 m 15 sec
Reputation Power: 0
Try this:

SELECT z.spouse_personid AS spouse1,
z.spouse_personid AS spouse2
FROM xxdv_personmaster_v z

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > Problem Selecting from View


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway