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

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -