mysql-error-1248

MySql: Query multiple identical dynamic tables

霸气de小男生 提交于 2019-12-13 01:08:29
问题 I have a database with 500+ tables, each with identical structure, that contain historical data from sensors. I am trying to come up with a query that will locate, for example, all instances where sensor n exceeds x. The problem is that the tables are dynamic, the query must be able to dynamically obtain the list of tables. I can query information_schema.tables to get a list of the tables, like so: SELECT table_name FROM information_schema.tables WHERE table_schema = 'database_name'; I can

mysql error code 1248

浪子不回头ぞ 提交于 2019-12-12 02:10:53
问题 I am getting an error code 1248 and have no idea why. Thanks in advance. select substr(cbt,1,8) day, max((delta_GTP_InDataPktGn+delta_GTP_OutDataPktGn))/900 from ( select a.cbt, a.datetime, a.GTP_InDataPktGn - b.GTP_InDataPktGn as delta_GTP_InDataPktGn, a.GTP_OutDataPktGn - b.GTP_OutDataPktGn as delta_GTP_OutDataPktGn from ( select cbt, STR_TO_DATE(substr(cbt,1,12),'%Y%m%d%H%i') as datetime, GTP_InDataPktGn, GTP_OutDataPktGn from sgsn_GTP ) a right join ( select cbt, STR_TO_DATE(substr(cbt,1

MYSQL ERROR 1248 (42000): Every derived table must have its own alias

Deadly 提交于 2019-11-29 06:30:49
I cant for the life of me figure out why this is erroring SELECT * FROM SELECT c.city_id, p.prop_ynow_id, p.propertyid, p.prop_add_value, p.name, picture, ifnull(p.address,'') as`location`, ifnull(city,'')as`city`, ifnull(ShortCut,'') as `state`, ifnull(p.zip,'') as `zip`, min(if(pr.minrent = 0,99999999,pr.minrent)) as minrent, max(pr.maxrent) as maxrent, '' as service, hood_id, ifnull(p.phone,'') as `phone`, latitude, longitude, min(CAST(pu.fullBath AS UNSIGNED)) as`minbath`, max(CAST(pu.fullBath AS UNSIGNED)) as`maxbath`, min(CAST(pu.Bed AS UNSIGNED)) as`minbed` , max(CAST(pu.Bed AS UNSIGNED

MYSQL ERROR 1248 (42000): Every derived table must have its own alias

天大地大妈咪最大 提交于 2019-11-27 23:58:55
问题 I cant for the life of me figure out why this is erroring SELECT * FROM SELECT c.city_id, p.prop_ynow_id, p.propertyid, p.prop_add_value, p.name, picture, ifnull(p.address,'') as`location`, ifnull(city,'')as`city`, ifnull(ShortCut,'') as `state`, ifnull(p.zip,'') as `zip`, min(if(pr.minrent = 0,99999999,pr.minrent)) as minrent, max(pr.maxrent) as maxrent, '' as service, hood_id, ifnull(p.phone,'') as `phone`, latitude, longitude, min(CAST(pu.fullBath AS UNSIGNED)) as`minbath`, max(CAST(pu

What is the error “Every derived table must have its own alias” in MySQL?

孤人 提交于 2019-11-25 21:48:20
问题 I am running this query on MySQL SELECT ID FROM ( SELECT ID, msisdn FROM ( SELECT * FROM TT2 ) ); and it is giving this error: Every derived table must have its own alias. What\'s causing this error? 回答1: Every derived table (AKA sub-query) must indeed have an alias. I.e. each query in brackets must be given an alias ( AS whatever ), which can the be used to refer to it in the rest of the outer query. SELECT ID FROM ( SELECT ID, msisdn FROM ( SELECT * FROM TT2 ) AS T ) AS T In your case, of