Multiple tables search
SELECT t1.name. "t1" As Table FROM t1
WHERE mobile_number = [Enter mobile number]
UNION ALL
SELECT t2.name, "t2" FROM t2
WHERE mobile_number = [Enter mobile number]
UNION ALL
SELECT t3.name, "t3" FROM t3
WHERE mobile_number = [Enter mobile number]
UNION ALL
SELECT t4.name, "t4" FROM t4
WHERE mobile_number = [Enter mobile number]
naveen prasad wrote:
In the Out put can I also get the table name where the mobile number exists.
"naveen prasad" wrote:
Dear thank you very much it really worked...
"Marshall Barton" wrote:
naveen prasad wrote:
I have a mdb file.
tables created t1,t2,t3,t4.
fields are almost same in all tables, but the data is different in all tables.
fields are.. name, age, mobile_number,place.
I want to create a query to get name by mobile_number search.
In query execution the input i want to give is mobile number only, it should
search the mobile number in all tables and get the correct name.
SELECT t1.name FROM t1
WHERE mobile_number = [Enter mobile number]
UNION ALL
SELECT t2.name FROM t2
WHERE mobile_number = [Enter mobile number]
UNION ALL
SELECT t3.name FROM t3
WHERE mobile_number = [Enter mobile number]
UNION ALL
SELECT t4.name FROM t4
WHERE mobile_number = [Enter mobile number]
--
Marsh
MVP [MS Access]
|