subselect
#1
is it possible to do a subselect in mysql with two different db?

#2

Sure thats possible

 

 

SELECT
s.a_keeper_idx as npcid,
n.a_name_usa as npcname,
i.a_name_usa as itemname,
i.a_price

FROM
t_shopitem s,
t_item i,
t_npc n

WHERE
s.a_item_idx = i.a_index

AND
n.a_index = s.a_keeper_idx

ORDER BY 
s.a_keeper_idx

#3
s, n, i | are the names db?

#4

t_shopitem s,
t_item i,
t_npc n

SELECT
s.a_keeper_idx as npcid,
n.a_name_usa as npcname,
i.a_name_usa as itemname,
i.a_price

FROM
emunew_data.t_shopitem s,
test_data.t_item i,
test_data.t_npc n

WHERE
s.a_item_idx = i.a_index

change emunew_data and test_data to your database names

#5

s n i are just like shortcuts defined in the FROM section. U could also write it like this

 

SELECTt_shopitem.a_keeper_idx as npcid,t_npc.a_name_usa as npcname,t_item.a_name_usa as itemname,t_item.a_priceFROMt_shopitem,t_item,t_npcWHEREt_shopitem.a_item_idx = t_item.a_indexANDt_npc.a_index = t_shopitem.a_keeper_idx

#6
ok ill try

#7
solved thanks

#8
Closed and moved.



Forum Jump:


Users browsing this thread: 1 Guest(s)