sql - mysql select conditional on existence of future records -


I have the following status. I have a database of transactions about many contracts. I am looking for transactions first Alpha & lt; Alpha Bound is the future of the contract, which means that there are records after the date of the same contract ID, I am doing this:

  MyDB has a transaction ID, date, alpha, Choose Contract ID, where date & gt; = '2000-01-01' and alpha & lt; Alpha Bound  

and then run the result again

 for  (i in 1: length (resultSet)) {date.tmp = resultSet [ I, date] contractID.tmp = resultSet [i, contractID] future = doQuery (select date from "myDB", select date, "+ date.tmp +" and contractID = "+ contractID.tmp)" (future is not empty ) {# Break! I wanted to enter}}  

How can I do this in 1 query? Thank you.

to:

  SELECT t.transactionid, t date, T. LFA, encontrited for mad BT VirusTidat> = '2000-01-01' and T.L.F. & LT; Alpha Bound and Existing (X-contracted X-axle to Xel X = Tactracted and X Datet> Teddy)  < / Pre> 

Comments