SQL script.... querying multiple values

gandy

Dedicated Member
Dedicated Member
May 13, 2003
94
0
102
Hello guys,

Ive been out of Mir for a while but tend to come back now and then (Gutted 3.55 are still the best files to use!)

I decided to make a quest that's been in my head for a while but wanted to query multiple values. The only example I can find is in the totalrewardsystem scripts. Below is what im trying to do:

SQL Table example
---------------------------------------------
Code:
Username / Q_IDX  /  Q_FLG0    /  QFLG1
Mark        1          22          33
Mark        2          17          16
Mark        3          12          17
James       1          14          27
James       2          23          18
James       3          1           42
---------------------------------------------

Im wanting to return the result of Q_FLG0 Where the username=X and Q_IDX=Y

eg Username=Mark Q_IDX=2 would return 17

again, I haven't scripted Mir for a long time and ive lost most of the old SQL code I did but this is what I half managed to get to:

[@main]
#ACT
FormatStr "FLD_Username='%s' and FLD_Q_IDX='2'" %USERNAME
Mov A8 %A9
ReadValueSql "TBL_Q_IDX_Record" %A8 "FLD_QFLG0" [@next1]

[@next1()]
#ACT
mov D1 %ARG(1)

#SAY
<$OUTPUT(D1)>\

---------- Post Merged at 02:49 PM ---------- Previous Post was at 02:49 PM ----------

Nevermind, I figured it out :)