Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 1 of 1 total
Thread How to do this part 2
Tue, Jan 16 2007 9:27 AMPermanent Link

"Petter Topp"
Hello Robert,

I have attached the table we have discussed, and a test project with my SQL.
It looks like this:
SELECT DISTINCT T1.TRANS_ID,  T1.LOCATION_ID, IF(T1.CUSTOMER_ID=NULL THEN
T2.CUSTOMER_ID ELSE T1.CUSTOMER_ID)
FROM Translogg T1 JOIN Translogg T2 ON T1.TRANS_ID=T2.TRANS_ID
WHERE T1.LOCATION_ID = '2'
GROUP BY T1.TRANS_ID

When I add the IF THEN ELSE part to the SQL, the result returns TWO records
one from T1 and one from T2. What I would like is just one record, with the
value from the other.
If you run my SQL you will also see a strange (probably not because i'm not
very good at this) thing with two records. Record with TRANS_ID = 00000125
and 00000127 they don't display the CUSTOMER_ID.

Thanks for taking the time...

Regards
Petter Topp








Attachments: Translogg.dat Translogg.idx SQL Test.zip
Image