-
Code's Tags
-
Your Codes
-
Reffers
-
Linked Codes
|
Code:
Short link for Twitter:
HTML:
HTML view:
Copy Source | Copy HTML begin DECLARE `datatable` VARCHAR(20) DEFAULT '`data`'; DECLARE `xtab_query` VARCHAR(4096) DEFAULT ''; if(DATE(`dfrom`) > DATE_SUB(NOW(), interval 8 DAY)) then SET datatable := "`data_week`"; #last week else if(DATEDIFF(`dto`,`dfrom`)>60) then SET datatable := "`data_ms`";#months else if(DATEDIFF(`dto`,`dfrom`)>14) then SET datatable := "`data_ws`"; #weeks end if; end if; end if; SET xtab_query := CONCAT("select * FROM ",`datatable`," d ........and 1 screen of query..."); PREPARE `xtab_query` FROM @xtab_query; EXECUTE `xtab_query`; end
|