wordpress - MySql how to avoid having to create temporary tables -


i'm new sql , have query need use through wordpress plugin (wp data tables) plugin doesn't allow creation of temporary tables.

to work around believe have create new tables within join i'm not sure how this.

the query need remove creation of table is:

create temporary table if not exists _surveydata  (select      _reftable.refid,     _reftable.clientref,     _reftable.sitename,     _jobtable.jobid,     _jobtable.jobtypeid,     _jobtable.jobcloseddate      _reftable, _jobtable     _reftable.refid = _jobtable.refid ,  _jobtable.jobtypeid = 1);  create temporary table if not exists _installdata  (select      _reftable.refid,     _reftable.clientref,     _reftable.sitename,     _jobtable.jobid,     _jobtable.jobtypeid,     _jobtable.jobcloseddate      _reftable, _jobtable     _reftable.refid = _jobtable.refid ,  _jobtable.jobtypeid = 2);  select     _reftable.refid,     _reftable.clientref,     _reftable.sitename,     _surveydata.jobid,     _surveydata.jobcloseddate,     _installdata.jobid,     _installdata.jobcloseddate     _reftable, _surveydata, _installdata     _reftable.refid = _surveydata.refid , _reftable.refid = _installdata.refid     order refid 

any or point in right direction appreciated.

changed temporary table sub queries.

try this:

select _reftable.refid,     _reftable.clientref,     _reftable.sitename,     _surveydata.jobid,     _surveydata.jobcloseddate,     _installdata.jobid,     _installdata.jobcloseddate reftable inner join(             select              _reftable.refid,             _reftable.clientref,             _reftable.sitename,             _jobtable.jobid,             _jobtable.jobtypeid,             _jobtable.jobcloseddate                  reftable, _jobtable _reftable.refid = _jobtable.refid ,  _jobtable.jobtypeid = 1             ) _surveydata on _reftable.refid = _surveydata.refid  inner join(             select              _reftable.refid,             _reftable.clientref,             _reftable.sitename,             _jobtable.jobid,             _jobtable.jobtypeid,             _jobtable.jobcloseddate               _reftable, _jobtable _reftable.refid = _jobtable.refid ,  _jobtable.jobtypeid = 2         ) _installdata on _reftable.refid = _installdata.refid order refid; 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -