Tech Support Forum banner
Status
Not open for further replies.
1 - 2 of 2 Posts

· Elite Commander
Veeam, HyperV, Vcentre, Server (2008 - 2022)
Joined
·
1,441 Posts
Discussion Starter · #1 ·
Hi,
Not sure where to put this.
I have two databases on the one server.

DB1 - planesp2_aircraft
table - adsb_logs

DB2 - planesp2_system
table - spotting

What I need to do is to move the contents of aircraft.adsb_logs to planesp2_system.spotting.

However the aircraft.adsb_logs only has 4 fields -

id
icao
firstSeen
lastSeen

and the destination database has a LOT more fields:

id
date
uname
location
type
registration
make
model
engine
operator
eng_make
eng_model
eng_vari
eng_num
role
config
icao
modes
ff
Secal
unotes
anotes

What I have as an example of some data from the logs table is -
Code:
1 4ca683 2018-07-12 13:05:56 2018-07-12 13:11:20
so this data from this table needs to be entered as follows into the spotting table (note I am only listing the fields amended with real data the rest can be "Null" ):

id 1
date 2018-07-12
uname David
location Kirkby Radar
type Radar
registration TBC
modes 4ca683

Note that from the adsb_logs table on DB1 to the destination DB2 spotting means a few new inserts, including name, location, type and registration.
And also that the date is adjusted from 2018-07-12 13:05:56 to just "2018-07-12"

Users for each DB have access to the other.

I am guessing either a cron job or a php page from which I can kick this off manually?
 

· Elite Commander
Veeam, HyperV, Vcentre, Server (2008 - 2022)
Joined
·
1,441 Posts
Discussion Starter · #2 ·
Hi all,
okay so an update, I have figured out part A. Now i need to figure out Part B:

The adsb_logs table only has 4 fields -

id
icao
firstSeen
lastSeen

and the destination database has a LOT more fields:

id
date
uname
location
type
registration
make
model
engine
operator
eng_make
eng_model
eng_vari
eng_num
role
config
icao
modes
ff
Secal
unotes
anotes

What I have as an example of some data from the logs table is -

Code:
1 4ca683 2018-07-12 13:05:56 2018-07-12 13:11:20
so this data from this table needs to be entered as follows into the spotting table (note I am only listing the fields amended with real data the rest can be "Null" ):

id 1
date 2018-07-12
uname David (Static Field)
location Kirkby Radar (Static Field)
type Radar (Static Field)
registration (takes data from ICAO field)

Note that from the adsb_logs table on DB1 to the destination DB2 spotting means a few new inserts, including name, location, type and registration.

This needs to be done by a MySQL script.
 
1 - 2 of 2 Posts
Status
Not open for further replies.
Top