Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 15

Discussione: Tabella riepilogativa

  1. #1

    Tabella riepilogativa

    Ciao,
    in un database Access ho le seguenti 2 tabelle:


    tabella "Coupon" (schedine inviate dagli utenti)

    cID --> Contatore
    cWeedID --> numerico (n° giornata di campionato)
    cNick --> testo
    cMatchID --> numerico (corrisponde al campo mID della tabella matches)
    cResult --> testo (1,2 o X)
    cSentDate --> data/ora


    tabella "matches"(partite)

    mID --> Contatore
    mWeekId --> Numerico (Giornata di campionato)
    mFirstTeam --> Testo (prima squadra in competizione)
    mSecondTeam --> Testo (seconda squadra in competizione)
    mResult --> Testo (risultato del confronto tra le due squadre - 1, 2 o X)
    mOrder --> Numerico


    Ho bisogno di fare in modo che in una pagina venga visualizzato per una giornata di campionato che scelgo il numero di risultati indovinati da ciascun utente(cNick). Si dovrebbe ottenere una cosa del tipo:


    andreis 6 partite indovinate
    erme 3 partite indovinate
    abra 11 partite indovinate

    Come posso ottenere una cosa del genere?
    Saluti,
    Carlostefano

  2. #2
    riposta la query che ti avevano già suggerito e dicci perchè non va
    IP-PBX management: http://www.easypbx.it

    Old account: 2126 messages
    Oldest account: 3559 messages

  3. #3
    Ok Santino,
    questa è la query:

    codice:
    select cnick, count(*) as quanti from (
    select cnick
    from coupon inner join matches on coupon.cmatchid = matches.mid and coupon.cresult = matches.mresult
    ) group by cnick
    having count(*) = 7

    Così non viene viene effettuato un filtraggio per giornata di campionato tra cui scegliere ma per numero di partite indovinate; mi servirebbe che venisse fatto l'elenco per ogni giocatore che ha partecipato del numero di partite indovinate per la giornata selezionata(mWeekID e cWeekID sono i campi che identificano il numero della giornata).

    Ciao,
    carlostefano

  4. #4
    prova
    codice:
    select cnick, count(*) as quanti from (
    select cnick
    from coupon inner join matches on coupon.cmatchid = matches.mid and coupon.cresult = matches.mresult and coupon.cMatchID =" & match_richiesto & "
    ) group by cnick
    having count(*) = 7

    dove match_richiesto è il numero (in questo caso preso da una variabile asp) ch eidentifica la giornata...guarda un pò se va
    IP-PBX management: http://www.easypbx.it

    Old account: 2126 messages
    Oldest account: 3559 messages

  5. #5
    Scusa però così darebbe tutti gli utenti che in quella giornata hanno indovinato 7 partite (having count(*) = 7); a me servirebbe invece l'elenco di tutti gli utenti che hanno partecipato a quella giornata di campionato, con il risultato per ciascuno del numero di partite indovinate.

  6. #6
    togli having count(*)=7
    IP-PBX management: http://www.easypbx.it

    Old account: 2126 messages
    Oldest account: 3559 messages

  7. #7
    Ho scritto così:

    strsql = "SELECT cNick, count(*) AS quanti FROM ( "
    strsql = strsql & "SELECT cNick FROM coupon INNER JOIN matches ON "
    strsql = strsql & "coupon.cMatchID = matches.mID AND coupon.cResult = matches.mResult "
    strsql = strsql & "AND coupon.cMatchID = 2"
    strsql = strsql & ") GROUP BY cNick"


    Viene restituito questo errore:


    Microsoft JET Database Engine error '80004005'

    Espressione join non supportata.

    /includes/coupon_subroutines-inc.asp, line 11

  8. #8


    codice:
     strsql = strsql & "SELECT cNick FROM coupon ,matches where"
    IP-PBX management: http://www.easypbx.it

    Old account: 2126 messages
    Oldest account: 3559 messages

  9. #9
    adesso ho messo così:


    strsql = "SELECT cNick, count(*) AS quanti FROM ( "
    strsql = strsql & "SELECT cNick FROM coupon, matches INNER JOIN matches ON "
    strsql = strsql & "coupon.cMatchID = matches.mID AND coupon.cResult = matches.mResult "
    strsql = strsql & "AND coupon.cMatchID = 2) "
    strsql = strsql & "GROUP BY cNick"



    da:

    Microsoft JET Database Engine error '80004005'

    Errore di sintassi nell'operazione JOIN.

    /includes/coupon_subroutines-inc.asp, line 11


  10. #10
    forse non ci siamo capiti:

    codice:
    strsql = strsql & "SELECT coupon.cNick FROM coupon ,matches where"
    leggi inner join?
    IP-PBX management: http://www.easypbx.it

    Old account: 2126 messages
    Oldest account: 3559 messages

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.