MySQL Forums
Forum List  »  Newbie

subquery in front clause between two dbs
Posted by: leandro roggerone
Date: July 16, 2018 07:34AM

Hi guys , I need to cross two databases with a from clause:
So far Im using two differents queries , like:
From db1

select * from fsan_top_100 order by hits desc limit 5;
+--------------+------+
| fsan         | hits |
+--------------+------+
| ZNTS035D41E3 |  172 |
| ZNTS0344E3BE |  164 |
| ZNTS037FB6ED |  156 |
| ZNTS037CD31C |  150 |
| ZNTS035D3D81 |  150 |
+--------------+------+
Then ; from db2 I need to do:

select ip_address from ZNTS035D41E3  order by date limit 1;
select ip_address from ZNTS0344E3BE  order by date limit 1;
select ip_address from ZNTS037FB6ED  order by date limit 1;
select ip_address from ZNTS037CD31C  order by date limit 1;
select ip_address from ZNTS035D3D81  order by date limit 1;

So ... is it possible to join both queryes , so far I have:
select ftth_cpe_history.ip_address from (select fsan from ftth_cpe_snap.fsan_top_100 order by hits desc limit 5)  ffsan ;
It returns :
ERROR 1054 (42S22): Unknown column 'ftth_cpe_history.ip_address' in 'field list'
I dont know how to continue ...
Any idea would be wellcome,
Thanks.

Options: ReplyQuote


Subject
Written By
Posted
subquery in front clause between two dbs
July 16, 2018 07:34AM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.