Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL select brings record over even when not match
Message
De
15/09/2005 11:12:04
 
 
À
15/09/2005 10:28:05
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 6 SP5
OS:
Windows 2000 SP4
Database:
Visual FoxPro
Divers
Thread ID:
01049862
Message ID:
01049910
Vues:
13
I don't understand why stu.enrollment_status <> 'INACTIVE' should be part of the JOIN. Rather, it should be in the WHERE clause:
   FROM students AS stu ;
   LEFT JOIN addresses AS adr ;
   ON stu.student_id = adr.student_id AND ;
   stu.school_year = adr.school_year ;
   WHERE stu.enrollment_status <> 'INACTIVE' ;
>Hi all,
>
>I have the following sql select sting that is bringing over records that do not match the commented line.
>
>
> SELECT stu.student_id, stu.school_year, last_name, first_name, ;
>   current_school, grade_level, gender_code, session_code, ;
>   padl(day(date_of_birth),2,"0") as dd________, ;
>   padl(month(date_of_birth), 2,"0") as mm________, ;
>   year(date_of_birth) as yy________, ;
>   address_mailing_line_1, address_city, state_code, ;
>   address_zipcode, address_name, address_type_code ;
>   FROM students AS stu ;
>   LEFT JOIN addresses AS adr ;
>   ON stu.student_id = adr.student_id AND ;
>   stu.school_year = adr.school_year ;
>   and stu.enrollment_status <> 'INACTIVE' ;  && This line
>   INTO CURSOR cstuadr nofilter
>
>The sql brings the records over even if the enrollment_status = 'inactive'
>
>What am I missing?
> I had that line as a where line, but then the sql does not bring any records over. I have 5 Active and 1 inactive students that I am working with at the moment.
>
>TIA
>Beth
Groet,
Peter de Valença

Constructive frustration is the breeding ground of genius.
If there’s no willingness to moderate for the sake of good debate, then I have no willingness to debate at all.
Let's develop superb standards that will end the holy wars.
"There are three types of people: Alphas and Betas", said the beta decisively.
If you find this message rude or offensive or stupid, please take a step away from the keyboard and try to think calmly about an eventual a possible alternative explanation of my message.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform