dickiebird
Programmer
Hi
I'm working in Sybase 12.0
I have two tables, MemberPromotion has 5 test cardnumbers.
Transactions has several rows, of varying Trandate for the same 5 test cardnumbers
I need to find the earliest Trandate row on Transactions for each cardnumber.
select *
from Transactions lct, MemberPromotion ba
where ba.CardNumber = lct.CardNumber
and ba.PointsAwarded =0
and lct.SettlementCurrency = "GBP"
and lct.TranDate = (select min(lct.TranDate)
from Transactions lct, MemberPromotion ba
where ba.CardNumber = lct.CardNumber
and ba.PointsAwarded =0
and lct.SettlementCurrency = "GBP"
This only returns one row, the one with the min(Trandate) from the table.
In my test table MemberPromotion, I expect all 5 rows to match and display
I need the min(Trandate) for each cardnumber that exists on both tables.
Where have I gone wrong ?
Any thoughts ?
TIA
Dickie Bird (-)))
I'm working in Sybase 12.0
I have two tables, MemberPromotion has 5 test cardnumbers.
Transactions has several rows, of varying Trandate for the same 5 test cardnumbers
I need to find the earliest Trandate row on Transactions for each cardnumber.
select *
from Transactions lct, MemberPromotion ba
where ba.CardNumber = lct.CardNumber
and ba.PointsAwarded =0
and lct.SettlementCurrency = "GBP"
and lct.TranDate = (select min(lct.TranDate)
from Transactions lct, MemberPromotion ba
where ba.CardNumber = lct.CardNumber
and ba.PointsAwarded =0
and lct.SettlementCurrency = "GBP"
This only returns one row, the one with the min(Trandate) from the table.
In my test table MemberPromotion, I expect all 5 rows to match and display
I need the min(Trandate) for each cardnumber that exists on both tables.
Where have I gone wrong ?
Any thoughts ?
TIA
Dickie Bird (-)))