I have an SQL table with Member ID’s.
Each member has information regarding their insurance claims listed in the table.
One column lists insurance ID’s in relation to Member-ID.
for example:-
|Member ID | Insurance Code |
----------------------------------
|C#$#@@!1231 | 67 |
Now the issue is the same member could have different Insurance Code#’s as a part of previous claims.
For example between 2010 -2011, the member had a claim Code = 67
But for 2011 – 2012, the member had a claim Code = 3
Now when I create a SQL query, I only get one value for claim code…. how can I get all the values, say 67, 3, and 110? Such that I can respond to all claims that the member has been a part of.
// SQL QUERY to gather member information.
DMS.ADOQuery1.SQL.Clear;
DMS.ADOQuery1.SQL.Add('select HPFROMDT, HPthruDt, MEMBERKEY, MEMBHPKEY, OPFROMDT, OPTHRUDT, HPCODEKEY' +
' from MEMBHP' +
' where MEMBERKEY = ''' + MembKey + ''' and OPTHRUDT >= ''' + init_date + ''' and OPFROMDT <= ''' + final_date +''' and OPFROMDT < OPTHRUDT'
);
// Showmessage(DMS.ADOQuery1.SQL[0]);
DMS.ADOQuery1.Open;
// Adding the query values to the appropriate variables.
HPCodeKey := (DMS.ADOQuery1.FieldByNAme('HPCODEKEY').AsString);
DMS.ADOQuery1.Close;
Check all the records returned by query, not only the first one.
Check also filter dates in SQL statement (where condition).