How do I sum 2 or 3 fields from a lookup fields in table?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello All!

I have the table F1UTc
CodAutonumber (PK)
CodFarmer (FK)
CodSemester (FK)
CodUT (Lookup field)
Quantity (numeric)

The CodUTc (Lookup field) have 8 values

I cretaed the sql:
SELECT F1UTc.CodPer, F1UTc.CodFin, F1UTc.CodUTc, F1UTc.Cantidad
FROM F1UTc
WHERE (((F1UTc.CodPer)="11") AND ((F1UTc.CodUTc)="2"));

What I would like to do is sum the total of values 2 and 6 from the CodUT
c(Lookup field) per CodSmester and per CodFarmer

Please help
 
SELECT CodFarmer, CodSmester, SUM(quantity)
FROM f1utc
WHERE codPer IN( "2", "6")
GROUP BY CodFarmer, CodSmester




assuming codPer is a string. If an integer, change the WHERE clause to:

WHERE codPer IN(2, 6)



Hoping it may help,
Vanderghast, Access MVP
 
Back
Top