This is my first time here and I am a beginner so kindly bear my idiot-ism 🙂
I want to run two queries in mysql, from two databases in a way that if first query generate s no results then second query should search the same thing in second data base.
We have motor insurance data and there are two databases one for individual customers and second for corporate customers. We need to search vehicle by its chasis no or engine no. from both databases but in a sequence that if from first database no result is found then it should go for second database.
First query:
SELECT * FROM skpoly_vw4 WHERE CHASIS = 878933
Second query:
SELECT * FROM vw_motorschedule where sw_skpoly_chasis = 878933
WE HAVE ONE DATABASE BUT IN IT WE HAVE TWO DIFFERENT VIEWS WHICH ARE skpoly_vw4 for individual customers and vw_motorschedule for corporate customers
use the
SELECT FOUND_ROWS( )after executing the first query.that is,
before running the second query check if
SELECT FOUND_ROWS( )>0EDIT:
Here is an example