Pagina 3 di 3 primaprima 1 2 3
Visualizzazione dei risultati da 21 a 28 su 28
  1. #21
    vero... ma l'errore resta...

  2. #22
    Si, ma in questa subquery hai usato f_mail invece di f_email

    codice:
    select date_format(data_inizio,"%c") as mese, 
    count(id) as app, sum(if(f_mail=1,1,0)) as flag_mail, 
    sum(if(f_sms=1,1,0)) as flag_sms 
    from agenda as t where year(data_inizio) = 2009 and id_cliente = 53 
    group by date_format(data_inizio,"%Y%m")
    Credo sia un'errore di distrazione

  3. #23
    Grazie per la correzione, ma con questa ho ancora lo stesso problema:

    codice:
    select m.mese,coalesce(appuntamenti,0) as appuntamenti, 
    coalesce(f_email,0) as flag_mail, 
    coalesce(f_sms,0) as flag_sms 
    from mesi as m 
    left join ( select date_format(data_inizio,"%c") as mese, 
    count(id) as appuntamenti, sum(if(f_email=1,1,0)) as flag_mail, 
    sum(if(f_sms=1,1,0)) as flag_sms from agenda as t 
    where year(data_inizio) = 2009 
    and id_cliente = 53 
    group by date_format(data_inizio,"%Y%m")) as tab on m.id = tab.mese

  4. #24
    Utente di HTML.it L'avatar di nicola75ss
    Registrato dal
    Nov 2004
    Messaggi
    12,922
    Posta un dump significativo.

  5. #25
    Utente di HTML.it L'avatar di luca200
    Registrato dal
    Apr 2002
    Messaggi
    4,120
    O magari spiega cosa vuoi fare. Quella query è totalmente insensata

  6. #26
    Ciao e grazie per le risposte,

    La tabella è questa:

    http://img137.imageshack.us/img137/5499/38586974.png

    e la tabella mesi:

    http://img710.imageshack.us/img710/3317/qwe.png

    Il dump della prima tabella: dump.

    Vorrei tirar fuori tutti gli appuntamenti dalla tabella dell'anno 2009 e raggrupparli per mese e stampare zero se non ci sono appuntamenti.

  7. #27
    Utente di HTML.it L'avatar di nicola75ss
    Registrato dal
    Nov 2004
    Messaggi
    12,922
    codice:
    select m.mese,count(a.id) as quanti
    from mesi as m
    left join agenda as a
    on m.id = month(a.data_inizio)
    and year(a.data_inizio) = 2009
    group by m.id
    order by m.id

  8. #28
    Gentilissimo ed efficace come sempre

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.