Post by Dorian Chalom123 12 Algebra
123 23 Algebra Workbook
234 34 The Earth
345
345
123 12 Algebra
123 23 Algebra Workbook
234 34 The Earth
345 45 Reading
345 56 Writing
But my problem is some classes may have two books required for them
and may not yet be assigned to the student so how do I get the query
to include the two books requeried for the class?
Hi Dorian,
You are still not making sense. You've described your final data in two
different ways. You haven't described how the students table figures into
the mix at all either.
Here's my best guess at your data. Please post similar DDL (Data Definition
Language) that illustrates all the data needed for your query and when you
post the result you want, please post the names of the columns.
Create Cursor StudTTbl (IDStudent I, StudentName C(10))
Insert Into StudTTbl Values (1234, "Joe Blow")
Create Cursor CrsDemo (IDCourse I, CrsName C(10))
Insert Into CrsDemo Values (123, "Math")
Insert Into CrsDemo Values (234, "Science")
Insert Into CrsDemo Values (345, "English")
Create Cursor dbfCrsBk(IDStudent I NULL, ;
IDCourse I, BookNum I, Descript C(10))
Insert Into dbfCrsBk Values ;
(1234, 123, 12, "Algebra")
Insert Into dbfCrsBk Values ;
(1234, 123, 23, "Alg Workbk")
Insert Into dbfCrsBk Values ;
(1234, 234, 34, "The Earth")
Insert Into dbfCrsBk (IDCourse, BookNum, ;
Descript) Values (345, 45, "Reading")
Insert Into dbfCrsBk (IDCourse, BookNum, ;
Descript) Values (345, 56, "Writing")
Select ;
CrsDemo.IDCourse, ;
dbfCrsBk.BookNum, ;
dbfCrsBk.Descript ;
From ;
crsDemo ;
Left Join dbfCrsBk On ;
CrsDemo.IDCourse = dbfCrsBk.IDCourse
--
Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
***@mvps.org www.cindywinegarden.com