sql - help to write a query statement -
I need a quorum statement, which it searches for three tables
Table 1
ID complete name active
Table 2
ID Full name
Table 3
id fullname
Let me query this all three tables And give me the results for those integers that are not active
Assuming that all the tables have the same structure (in your example they do not - is this an error?) Then you can use UNIAS to combine results with multiple queries:
SELECT id, fullname, 'table1' AS from Table 1 AS source WHERE active = 'N' union Select all ID, full name, 'Table 2' from AS2 source source Where Active = 'N' Union Select, Full Name, 'Table 3' from AS 3 Source where Active = 'N'
/ pre>If you do not care then the rows come to you and you do not want to duplicate that you can try the union instead:
SELECT id, fullname From table1 WHERE active = 'n' union selection id, full name table 2 WHERE active = 'n' union selection id, table 3 with full name WHERE active = 'n'
I I'm guessing. If this does not work, please explain what you are trying to do.
Comments
Post a Comment