Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help with SQL statement
Message
 
 
À
22/12/2003 19:12:35
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00861465
Message ID:
00861489
Vues:
19
This message has been marked as the solution to the initial question of the thread.
Paul,

Try
SELECT * FROM mytable 
	WHERE 
		( 
		(CASE WHEN q1a>2 THEN 1 ELSE 0 END) + 
		(CASE WHEN q1b>2 THEN 1 ELSE 0 END) + 
		(CASE WHEN q1c>2 THEN 1 ELSE 0 END) + 
		(CASE WHEN q1d>2 THEN 1 ELSE 0 END) ) >=2 
		OR ( 
		(CASE WHEN q2a>2 THEN 1 ELSE 0 END) + 
		(CASE WHEN q2b>2 THEN 1 ELSE 0 END) + 
		(CASE WHEN q2c>2 THEN 1 ELSE 0 END) + 
		(CASE WHEN q2d>2 THEN 1 ELSE 0 END) ) >=2 
>Hi ppl,
>
>I need a little help with a sql statement
>
>I have 8 fields like this q1a,q1b,q1c,q1d,q2a,q2b,q2c,q2d
>
>each field is int()
>values can be from 0 to 4
>
>I need to only return a result set if 2 of the q1's values are greater than 2 or 2 of the q2's values are greater than 2
>
>This will be running as a stored proc in SQL
>
>
>Thanks in advance
>
>Paul
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform