join - Convert MS Access query with subquery to MySQL -
for website (php / mysql) need management information. during test able produce working query in ms access.
subquery ‘qryunion’:
select mailadres, registrationdate tbl-a union select mailadres, registrationdate tbl-b;
main query:
select year([maildate]) & '-' & month([maildate]) monthmailed, count(tbl-c.mailadres) prospects, count(qryunion.mailadres) members tbl-c left join qryunion on tbl-c.mailadres = qryunion.mailadres group year([maildate]) & '-' & month([maildate]);
i want convert mysql database. tried working alias or temporary table, can’t running code. know how this?
move union inline view below.
you'll have replace string additions concat() function , cast int char. i'm not positive have syntax correct may close.
select concat(cast(year(`maildate`) char),'-',cast(month(`maildate`) char) monthmailed, count(tbl-c.mailadres) prospects, count(qryunion.mailadres) members tbl-c left join (select mailadres, registrationdate tbl-a union select mailadres, registrationdate tbl-b) qryunion on tbl-c.mailadres = qryunion.mailadres group concat(cast(year(`maildate`) char),'-',cast(month(`maildate`) char);
corrected ) in wrong place on year evaluation , cast char. of select , group by.
Comments
Post a Comment