MySQL Forums
Forum List  »  Italian

Ricerca dati in tabelle con select
Posted by: carmine cuomo
Date: October 22, 2008 07:01AM

Voglio consultare la tabella "estrazioni" in modo da conoscere quante volte sono stati estratti contemporaneamente il n. 2 e il n. 63 sulla ruota di napoli, io uso il seguente comando:
select * from estrazioni where ruota='"na"' and (((primo in(2,63) and (secondo in(2,63) or terzo in(2,63) or quarto in(2,63) or quinto in(2,63))) or (secondo in(2,63) and (terzo in(2,63) or quarto in (2,63) or quinto in (2,63))) or terzo in (2,63) and(quarto in(2,63) or quinto in(2,63))) or (quarto in(2,63) and quinto in(2,63)));
la tabella รจ la seguente:
Field | Type | Null | Key | Default | Extra |
+---------+------------+------+-----+---------+----------------+
| id | int(6) | NO | MUL | NULL | auto_increment |
| ruota | varchar(4) | NO | | NULL | |
| primo | int(2) | YES | | NULL | |
| secondo | int(2) | YES | | NULL | |
| terzo | int(2) | YES | | NULL | |
| quarto | int(2) | YES | | NULL | |
| quinto | int(2) | YES | | NULL | |
+---------+------------+------+-----+---------+----------------+
Esiste un comando tale da farmi digitare una volta sola la coppia di numeri da cercare invece di riperli come ho fatto nel comando mostrato?



Edited 1 time(s). Last edit at 10/22/2008 10:57AM by carmine cuomo.

Options: ReplyQuote


Subject
Views
Written By
Posted
Ricerca dati in tabelle con select
6250
October 22, 2008 07:01AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.