mysql - table with data from combined tables -
i know can combine tables sql queries, that's not looking for.
imagine having 10 tables, identical, reasons, not want mix data in 1 table. though! on other hand, create search results want able single sql query: (select * combined_table name='whatever')
in data on fly 10 tables...
possible, yes/no?
you want put data single table.
let's have ten different types of data. add column called type
(you should choose better name) , allow have value 1 10. query work without changes.
you can still data separately if wish:
select * yourtable name = 'whatever' , `type` = 3
the reason can think of not doing if have different users different permissions , want use tables control users can see data.
if despite benefits, still don't want put data in 1 table can solve issue using union all
.
create view yourview select col1, col2, ..., coln table1 union select col1, col2, ..., coln table2 union select col1, col2, ..., coln table3 union etc...
Comments
Post a Comment