i am havin a bit of trouble with a report I am trying to generate. I have 2 databases on 2 seperate mysql hosts. Database 1 holds monitoring info and Database 2 holds account info (again, these are 2 different mysqwl hosts).
What I am trying to accomplish is being able to sort by the account_id gathered from Database 2. However, I must first find all monitored hostnames to be able to pull the account_id based on host_name from db1. Here is what iu have so far"
Database 1:
SELECT services.host_id, hosts.host_name FROM services, hosts WHERE services.host_id = hosts.host_id;
This gives me the hostname monitored which i can then search for in db2 below.
Database 2:
select account_id from ve where ve_id=(select ve_id from om_website where name = '$hostname');
$hostname comes from DB1.
My problem is that I can do while loop for each hostname from db1 to find the account_id from db2, but i can sort this via the account_id since each hostname will only have account_id returned.
Does anyone see a way I can perhaps store ALL returned rows into a single array and then be able to do a sorted print from the array of ALL returned rows from db2?
Any other suggestions are welcome as well. Remember, I on doing a while loop on the returened hostname as that is the only way to gather the account_id (which i want to sort by).
Thanks in advance!!!!
Roy
What I am trying to accomplish is being able to sort by the account_id gathered from Database 2. However, I must first find all monitored hostnames to be able to pull the account_id based on host_name from db1. Here is what iu have so far"
Database 1:
SELECT services.host_id, hosts.host_name FROM services, hosts WHERE services.host_id = hosts.host_id;
This gives me the hostname monitored which i can then search for in db2 below.
Database 2:
select account_id from ve where ve_id=(select ve_id from om_website where name = '$hostname');
$hostname comes from DB1.
My problem is that I can do while loop for each hostname from db1 to find the account_id from db2, but i can sort this via the account_id since each hostname will only have account_id returned.
Does anyone see a way I can perhaps store ALL returned rows into a single array and then be able to do a sorted print from the array of ALL returned rows from db2?
Any other suggestions are welcome as well. Remember, I on doing a while loop on the returened hostname as that is the only way to gather the account_id (which i want to sort by).
Thanks in advance!!!!
Roy