Home > database >  [for post] have MySQL great god and have a look
[for post] have MySQL great god and have a look

Time:10-22

Now I want to do a data record database, the database table will be based on the current number of time and the last time is constantly creating form creation (30 days to create a set),
Query so it has a variety of forms, but each form of data format definition is the same, one column is a datetime,
After creating the more tables, the query becomes difficult for me,
By querying the column definition can I find out: what created the table, but how from so many forms according to the datetime detected at the same time all other data becomes a problem, hope to be solved,

CodePudding user response:

SELECT * FROM table 1 and table 2, table 3 WHERE DATETIME> 'the 2020-09-24 09:24:59 AND DATETIME<'the 2020-10-25 09:25:20';
This way of query must be wrong, I have a small white, not too complicated grammar, hope to understand one can help me,
Listed the wrong grammar is to say the simple point, probably means how like a single query table query table,

CodePudding user response:

But how from so many forms according to the datetime detected at the same time all other data becomes a problem, don't understand this sentence, check the data according to the scope of the time

CodePudding user response:

According to years to build a table, for example, table_2020_01, table_2020_02 etc., and then according to the time range in the SQL query, but in this time range may across, you see is business compromise, not across in the query, or is the time to write SQL with the union spell two tables

CodePudding user response:

reference evanweng reply: 3/f
can according to the monthly to build a table, for example table_2020_01, table_2020_02 etc., and then according to the time range in the SQL query, but in this time range may across, you see is business compromise, not across in the query, or is the time to write SQL with the union spell two tables

Yes, that's depends on how you can across the query in February, one thousand the day just across the two months, is a big hassle, spell table query how hey, can you write a demonstration to see

CodePudding user response:

You build a view is not to go, as long as the view changes regularly

CodePudding user response:

What is your backend language, use the persistence layer framework

CodePudding user response:

refer to 6th floor evanweng response:
what is your backend language, what with the persistence layer framework

Something simple, is to use the labview ODBC data source connection on the computer

CodePudding user response:

reference 5 floor sxq129601 reply:
you a view is not to go, as long as the timing to modify the view content

That is not... It is in trouble, I'll go to understand

CodePudding user response:

This involves the federated query, similar to the following statement

 select a. *, b * from user a left join pj_tester b on Anderson TCode=b.T este 


https://blog.csdn.net/ericwuhk/article/details/106411528

CodePudding user response:

With the union can solve your problem,
Create table has rules, then you can know what data in table, such as in table_2020_01 table_2020_02, table_2020_03
Queries can be so write:
Select * from table_2020_01 where datetime> 'the 2020-09-24 09:24:59 and datetime<'the 2020-10-25 09:25:20'
The union [all]
Select * from table_2020_02 where datetime> 'the 2020-09-24 09:24:59 and datetime<'the 2020-10-25 09:25:20'
The union [all]
Select * from table_2020_03 where datetime> 'the 2020-09-24 09:24:59 and datetime<'the 2020-10-25 09:25:20'
  • Related