[Solved]Multiple Databases in WHERE clause
#1

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.

#2


 

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

#3

Much apprechiated, thanks alot Smile

 

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

 

#Solved



Forum Jump:


Users browsing this thread: 1 Guest(s)