Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
* appearing as total
Message
De
25/11/1999 16:57:59
 
 
À
25/11/1999 16:44:00
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00295641
Message ID:
00295645
Vues:
29
>Here is my query:
>
>select distinct instructor.instructorid, course.courseid, studentcourse.sckey,;
>(iif(studentcourse.ispaid = .T.,(course.hours * paymodel.rate) *
>count(studentcourse.courseid),0)) as total;
> from course left join studentcourse on course.courseid = studentcourse.courseid;
> left join instructor on studentcourse.instructorid = instructor.instructorid;
> left join paymodel on instructor.training = paymodel.traintype;
>into cursor temppay;
>group by course.courseid
>
>This gives me all the courses even if they don't have an instructor. I then want to check if in the studentcourse table if the ispaid field is true. If it is I want to total up how much they are to be paid. If not they get 0 for that student. The total is 0 for all the ones that ispaid = .F. but the ones that equal true the total field equals a star(*). Does anyone know why this is happening? I don't know if it really makes sense.
>
>Thanks in advance,
>Tyler

When the SELECT-SQL statement is run, the Total column gets its width from the FIRST row in the selected result. Your first row value for Total is 0, so the column is being set to N(1, 0). Subsequent non-zero values are overflowing, hence the *.

If you have an idea of the range of values encompassed by Total, you can use something like
>select distinct instructor.instructorid, course.courseid, studentcourse.sckey,;
>(iif(studentcourse.ispaid = .T.,(course.hours * paymodel.rate) *
>count(studentcourse.courseid),<i>000000.00</i>)) as total;
>	from course left join studentcourse on course.courseid = studentcourse.courseid;
>		left join instructor on studentcourse.instructorid = instructor.instructorid;
>		left join paymodel on instructor.training = paymodel.traintype;
>into cursor temppay;
>group by course.courseid
This forces/tells the SELECT-SQL what width/precision to use for the column.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform