Steve-vfp9user
Programmer
Hello all
I have created a small application with a list of clients I do jobs for.
Each client has an ID number stored in a field called CLIENTID N(8) - Table MYCLIENTS
When I create a job this is given a Job Number and also a URN in a field called JOBLINK N(8) - Table THEJOBS
When items are logged against the job, they are linked with the same JOBLINK N(8) number - Table LINKITEMS
This all works fine.
If I add another job for the same client, this is given a new Job Number and new URN but the CLIENTID is also stored against the new job.
Example:
Client - Dave Anderson (Client ID 15)
Job number 100/2021 - Paint a wall
Client - Dave Anderson (Client ID 15)
Job nunber 101/2021 - Paint another wall
Client - Bill Harrison (Client ID 21)
Job number - 102/2021 - Remove a door
Client - Dave Anderson (Client ID 15)
Job nunber 103/2021 - Paint a ceiling
So what I am trying to achieve is for Client Dave Anderson's jobs to be consolidated as one:
Dave Anderson
Job number 100/2021 - Paint a wall
Job nunber 101/2021 - Paint another wall
Job nunber 103/2021 - Paint a ceiling
I have looked at the help file and found something called GROUP BY but I am not that knowledgeable with SQL so perhaps there is a different way of doing this.
Once I have created my list I will be printing the invoice (grouped) but then I need to replace a field (INVSENT) with a "Y" to show it has been printed/sent. I can update it accordingly once (and when!) it's been paid.
If you need any additional information, please let me know.
Any pointers or suggestions would be very much appreciated.
Thank you
Steve Williams
VFP9, SP2, Windows 10
I have created a small application with a list of clients I do jobs for.
Each client has an ID number stored in a field called CLIENTID N(8) - Table MYCLIENTS
When I create a job this is given a Job Number and also a URN in a field called JOBLINK N(8) - Table THEJOBS
When items are logged against the job, they are linked with the same JOBLINK N(8) number - Table LINKITEMS
This all works fine.
If I add another job for the same client, this is given a new Job Number and new URN but the CLIENTID is also stored against the new job.
Example:
Client - Dave Anderson (Client ID 15)
Job number 100/2021 - Paint a wall
Client - Dave Anderson (Client ID 15)
Job nunber 101/2021 - Paint another wall
Client - Bill Harrison (Client ID 21)
Job number - 102/2021 - Remove a door
Client - Dave Anderson (Client ID 15)
Job nunber 103/2021 - Paint a ceiling
So what I am trying to achieve is for Client Dave Anderson's jobs to be consolidated as one:
Dave Anderson
Job number 100/2021 - Paint a wall
Job nunber 101/2021 - Paint another wall
Job nunber 103/2021 - Paint a ceiling
I have looked at the help file and found something called GROUP BY but I am not that knowledgeable with SQL so perhaps there is a different way of doing this.
Code:
SELECT Select_List
FROM Table_List
...[WITH (BUFFERING = lExpr)]
[WHERE Conditions]
[GROUP BY Column_List]
[HAVING Conditions]
[UNION Clause]
[ORDER BY Column_List]
[INTO Clause | TO Clause ]
[Additional_Display_Options]
Once I have created my list I will be printing the invoice (grouped) but then I need to replace a field (INVSENT) with a "Y" to show it has been printed/sent. I can update it accordingly once (and when!) it's been paid.
If you need any additional information, please let me know.
Any pointers or suggestions would be very much appreciated.
Thank you
Steve Williams
VFP9, SP2, Windows 10