June 30, 2009 at 10:16 am
I inherited a weird setup. A Progress database is copied to a SQL Server 2005 database. One of the queries I have been asked to write would be easy if the JOIN that I have to do were on one field. However, this thing is set up very weird. There is nothing unique about any one field in row in Table A or Table B. However, the combination of TableA.Field1 and TableA.Field2 is unique. The same two fields exist in TableB.
If I had free reign on this thing, I would simply add a column and make it a primary key. But I can't. So how can I perform a JOIN in a SELECT statement and the JOIN be based on the fact that both Field1 and Field2 must match in both table for the row to be joined?
June 30, 2009 at 10:21 am
select
*
from
TableA ta
inner join TableB tb
on (ta.Col1 = tb.Col1
and ta.Col2 = tb.Col2)
hth
June 30, 2009 at 11:51 am
It works for SQL Server, but sadly, not for Progress. I will keep digging. Thanks.
June 30, 2009 at 12:11 pm
In oracle this used to work (If my memory serves me right)..
Select * from tablea where (col1,col2) in (Select col1,col2 from tableb)
You could try that
-Roy
June 30, 2009 at 12:18 pm
I don't work with Progress often, but had bookmarked this link to a Progress coding manual when I had a question one time. If you search for 'join' it will take you to examples that may help:
June 30, 2009 at 12:24 pm
Sorry, you said the data was copied to SQL Server from a Progress database, not that you were directly querying a Progress database.
June 30, 2009 at 1:03 pm
Yeah, looking back, I was clear as mud. My apologies. I have this query working fine when selecting from SQL Server. However, the MSS data isn't current. I can make it current with a SP that I built. But we wanted to get the same data from the original source, which is Progress, since it's live data. Thing is, the SQL syntax is very weird for Progress, at least from the standpoint of someone who is used to MSS.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply