LCKB
subselect - 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: Ep2 Support (https://lckb.dev/forum/forumdisplay.php?fid=166)
+------ Forum: Solved Topics (https://lckb.dev/forum/forumdisplay.php?fid=144)
+------ Thread: subselect (/showthread.php?tid=2459)



- kixtzz - 09-18-2013

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




- Wizatek - 09-18-2013


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




- kixtzz - 09-18-2013

s, n, i | are the names db?




- luoo - 09-18-2013


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




- Wizatek - 09-18-2013


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




- kixtzz - 09-18-2013

ok ill try




- kixtzz - 09-20-2013

solved thanks




- Paramount - 09-21-2013

Closed and moved.