PDA

View Full Version : [sql-access] creare boolean di confronto


nayma
03-12-2008, 10:18
Ciao a tutti!!
Dobbiamo fare un confronto tra due campi di una tabella (in particolare sono 2 anni): se sono uguali dobbiamo avere di ritorno un true, altrimenti un false.
Abbiamo trovato che esiste in access la funzione iif, ma parrebbe non funzionare..
Qualcuno può aiutarci??
:mc:
Grazie, Mire & Ele

john_revelator
03-12-2008, 14:55
Anche se non hai fornito molte informazioni immagino che il problema sia dovuto al fatto che i tuoi campi siano di tipo testo anzichè numerico e quindi venga effettuato un confronto tra stringhe.
Se la mia supposizione è giusta usa due campi di tipo numerico oppure, all'interno dell'if, "casta" i valori ad interi con la funzione cint.

IIf(CInt(anno1)>=CInt(anno2),1,0) as confronto

Hardware Upgrade Forum Database Error
Database Error Database error
The Hardware Upgrade Forum database has encountered a problem.

Please try the following:
  • Load the page again by clicking the Refresh button in your web browser.
  • Open the www.hwupgrade.it home page, then try to open another page.
  • Click the Back button to try another link.
The www.hwupgrade.it forum technical staff have been notified of the error, though you may contact them if the problem persists.
 
We apologise for any inconvenience.