September 5, 2006 at 10:51 am
Can somebody help me with the following query, I'm trying to combine the two rows so that only one row shows per "PayTransID" value
Thanks
September 5, 2006 at 11:34 am
Can you post your query.. Thant might help.
September 6, 2006 at 5:31 am
Sorry,
the picture in the message above was meant to include a screen shot of the query builder. I won't have access to the pic again until tonight. I will repost the screenshot then.
Thanks
September 6, 2006 at 6:54 am
Generally speaking you will need to read the same file back in for a second time. For example:
Select name, title, sex, hair, t1.sexdesc, t2.hairdesc
From dbo.personel as P
INNER JOIN dbo.DESCTBLE as T1 on T1.sex = P.sex
INNER JOIN dbo.DESCTBLE as T2 on t2.hair = p.hair
The description table is read in twice and the numeric codes are matched. This will result in having multiple descriptions on each row.
September 6, 2006 at 10:54 am
Hop you were trying to do this:
--Sample Data
Create table Ppl(PPLname varchar(100), title varchar(100), sex char(1), hair char(50))
Create table DESCTBLE (Code nvarchar(50), CodeDesc char(255))
Insert into Ppl
select 'AAA','Mr A','M','Black'
union
select 'BBB','Mr B','M','Brown'
union
select 'CCC','Ms C','F','Brown'
union
select 'DDD','Ms D','F','Black'
Insert DESCTBLE
select 'M','Male'
union
select 'F','Female'
union
select 'Black','Black Color'
union
select 'Brown','Brown Color'
union
select 'Blue','Blue Color'
Here is your query
-----------------
Select PPLname, title, sex, hair, t1.CodeDesc, t2.CodeDesc
From dbo.Ppl as P
INNER JOIN dbo.DESCTBLE as T1 on P.sex = T1.Code
INNER JOIN dbo.DESCTBLE as T2 on P.hair = T2.Code
September 6, 2006 at 2:51 pm
Here is the screen shot:
September 7, 2006 at 2:37 pm
Any ideas folks? I refuse to be beaten on this one, and I'm 99.9% certain its "do-able!"
September 12, 2006 at 1:46 am
Could it have something to do with the joins?
September 12, 2006 at 11:52 am
have you tried it with inner joins instead of outer joins?
September 12, 2006 at 11:58 am
Viewing 10 posts - 1 through 9 (of 9 total)
You must be logged in to reply to this topic. Login to reply