LCKB
[Solved]Multiple Databases in WHERE clause - Printable Version

+- LCKB (https://lckb.dev/forum)
+-- Forum: ** OLD LCKB DATABASE ** (https://lckb.dev/forum/forumdisplay.php?fid=109)
+--- Forum: Guides & Help Section (https://lckb.dev/forum/forumdisplay.php?fid=193)
+---- Forum: Help & Support (https://lckb.dev/forum/forumdisplay.php?fid=157)
+----- Forum: Ep3 Support (https://lckb.dev/forum/forumdisplay.php?fid=150)
+------ Forum: Solved topics (https://lckb.dev/forum/forumdisplay.php?fid=151)
+------ Thread: [Solved]Multiple Databases in WHERE clause (/showthread.php?tid=3644)



- Creep - 03-13-2014


Hey Guys,
I need some help with a SQL query.
 

UPDATE
ep3_db_auth.bg_user
SET
ep3_db_auth.bg_user.cash=ep3_db_auth.bg_user.cash+ep3_db.t_stash00.a_count
WHERE
ep3_db_auth.bg_user.user_code=ep3_db.t_stash00.a_user_idx
AND
ep3_db.t_stash00.a_item_idx=9891;

Both are the same, 9891 shall be an item doenst matter atm.
 
Actually I try to get the amount of the items out of the stash and add it to the cash. After that another querry would delete the items out of the stash. Anyways, the problem is that it gives out an error like this:
 
[Err] 1054 - Unknown column ep3_db.t_stash00.a_user_idx in where clause
 
To be said is that the column is defently there.
 
I would be thankful for any advise.
 
Thanks so far,
Creep.




- Canton - 03-15-2014



 

UPDATE ep3_db_auth.bg_user SET cash = cash + (SELECT a_count FROM ep3_db.t_stash00 WHERE a_item_idx = 9891 AND user_code = a_user_idx) WHERE user_code IN (SELECT a_user_idx FROM ep3_db.t_stash00 WHERE a_item_idx = 9891);

 

 

Have fun Smile




- Creep - 03-15-2014


Much apprechiated, thanks alot Smile

 

I tought about that way but I wanted it to do the hard way xD

 

#Solved