I am mySQL rookie. These are my tables
Cust Table
-------------------
custID1, fname, lname
custID2, fname, lname
custID3, fname, lname
Package Table
-------------
pckgID1, descr1
pckgID2, descr2
pckgID3, descr3
custPackage Table
------------------------------
custID1, pckgID3, begDate, endDate
Note: the custPackage table identifies which package a customer purchased and how long the package is good for.. usually about 1 month
i.e. begDate = 2005-11-1
endDate = 2005-11-30
reservations
---------------------------------------
resID, custid, serviceDescr, apptBegDate, apptEndDate
Objective: Create CR (v7) report to show packages that were purchased and whether or not there are reservations made for the period the package is in effect.
This report will generate upon the request made on vb6 front-end, with mySQL 4 at the backend.
As it stands, there is no direct link from the Package the customer purchased to the reservations made for that package. Not the most elegant so I must rely then on looking at the begDate and endDate in the custPackage table and find what reservations for that customer falls between these dates.
The challenge is the CR 7 and mySQL 4 do not support stored procedures nor subqueries...which is how I would have gone about this. Anyhow, after some reading, most of this processing will have to occur at the application level. Long story short, I need help formulating the select statements.
This is my thought process so far. Am I in the right direction?
Within the VB application
1. Join the cust, custPackage, and Package tables and place the results in Temp or perm table
2. Join temp or perm table to reservations based on custID and do a date comparison.
Can a temp table get created within the VB application, being that temp tables are only good within the mysql session?
Appreciate any help. Thx.
Cust Table
-------------------
custID1, fname, lname
custID2, fname, lname
custID3, fname, lname
Package Table
-------------
pckgID1, descr1
pckgID2, descr2
pckgID3, descr3
custPackage Table
------------------------------
custID1, pckgID3, begDate, endDate
Note: the custPackage table identifies which package a customer purchased and how long the package is good for.. usually about 1 month
i.e. begDate = 2005-11-1
endDate = 2005-11-30
reservations
---------------------------------------
resID, custid, serviceDescr, apptBegDate, apptEndDate
Objective: Create CR (v7) report to show packages that were purchased and whether or not there are reservations made for the period the package is in effect.
This report will generate upon the request made on vb6 front-end, with mySQL 4 at the backend.
As it stands, there is no direct link from the Package the customer purchased to the reservations made for that package. Not the most elegant so I must rely then on looking at the begDate and endDate in the custPackage table and find what reservations for that customer falls between these dates.
The challenge is the CR 7 and mySQL 4 do not support stored procedures nor subqueries...which is how I would have gone about this. Anyhow, after some reading, most of this processing will have to occur at the application level. Long story short, I need help formulating the select statements.
This is my thought process so far. Am I in the right direction?
Within the VB application
1. Join the cust, custPackage, and Package tables and place the results in Temp or perm table
2. Join temp or perm table to reservations based on custID and do a date comparison.
Can a temp table get created within the VB application, being that temp tables are only good within the mysql session?
Appreciate any help. Thx.