[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.9

Making a more simple select

Asked by jaymz69 in FoxPro Database

I have 19 product codes to get the 12 month $ on. Column for easch month is how it is in the database

right now I am doing a sqlexec() for each one.. yes 19 sqlexec() then a select after each one so I can SUM() all 12 months

then do some customer match with marketing codes...

now I need to match all 19 up..........
is there a way I can run one sqlexec() && do a in(all codes here)
then one select after to sum() each 19 12 months up

then run the cust markteing codes select.... and have it run a seek or somethiong?

Yes beginner here but I am sure there is a better way to handle all these..
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
ldYear = YEAR(DATE())
 
lnhandle = SQLCONNECT(lnDNS, lnUser, lnPwd)
 
IF lnHandle > 0 
 
*****************************************************************
*::::														::::*
*:::: 			Load Customer by sales rep					::::*
*::::														::::*
*****************************************************************
 
* CUSTMAST
SQLEXEC(lnHandle, "select cmcust, cmname, cmadr1, cmadr2, cmadr3, cmzip, cmphon, cmco, cmslmn, cmslm2 from custmast", "cCustmast")
 
 
* SALESMAN
SQLEXEC(lnHandle, "select smno, smname from salesman", "cSalesman")
 
select * from cSalesman, cCustmast where cmslmn=smno into cursor cCustSalesMan readwrite
 
*****************************************************************
*::::														::::*
*:::: 		Load Customer marketing Codes					::::*
*::::														::::*
*****************************************************************
 
* CUSTMKTG
SQLEXEC(lnHandle, "select * from custmktg", "cCustmktg")
 
* MKCDMAST
SQLEXEC(lnHandle, "select * from mkcdmast", "cMkcdmast")
 
* TA marketing code
select cmkcus, cmname, cmadr3, cmkmkc, mcdesc from cCustmktg, cMkcdmast, cCustmast where CMKMKC='TA' AND ;
		cmkcus=cmcust AND cmkmkc=mcmkcd into cursor cCustMarketingCodesTA readwrite
* JW marketing code
select cmkcus, cmname, cmadr3, cmkmkc, mcdesc from cCustmktg, cMkcdmast, cCustmast where CMKMKC='JW' AND ;
		cmkcus=cmcust AND cmkmkc=mcmkcd into cursor cCustMarketingCodesJW readwrite
 
*****************************************************************
*::::														::::*
*:::: 			Load all the product codes					::::*
*::::														::::*
*****************************************************************
 
* Product Code 13602 - 72
SQLEXEC(lnHandle, "SELECT CPCUST, CPPRCD, CPYEAR, CPS$01, CPS$02, CPS$03, CPS$04, CPS$05, CPS$06, CPS$07, CPS$08, CPS$09, CPS$10 , CPS$11 , CPS$12 ;
FROM csprhist WHERE CPPRCD=13602 and cpyear=?ldYear", "c13602")
 
 
* Product Code 13603 - 73
SQLEXEC(lnHandle, "SELECT CPCUST, CPPRCD, CPYEAR, CPS$01, CPS$02, CPS$03, CPS$04, CPS$05, CPS$06, CPS$07, CPS$08, CPS$09, CPS$10 , CPS$11 , CPS$12 ;
	FROM csprhist WHERE CPPRCD='13603' and cpyear=?ldYear", "c13603")
 
* Product Code 13603 - 73
SQLEXEC(lnHandle, "SELECT CPCUST, CPPRCD, CPYEAR, CPS$01, CPS$02, CPS$03, CPS$04, CPS$05, CPS$06, CPS$07, CPS$08, CPS$09, CPS$10 , CPS$11 , CPS$12 ;
	FROM csprhist WHERE CPPRCD='13603' and cpyear=?ldYear", "c13603")
	
* Product Code 13604
SQLEXEC(lnHandle, "SELECT CPCUST, CPPRCD, CPYEAR, CPS$01, CPS$02, CPS$03, CPS$04, CPS$05, CPS$06, CPS$07, CPS$08, CPS$09, CPS$10 , CPS$11 , CPS$12 ;
	FROM csprhist WHERE CPPRCD='13604' and cpyear=?ldYear", "c13604")
	
* Product Code 13605
SQLEXEC(lnHandle, "SELECT CPCUST, CPPRCD, CPYEAR, CPS$01, CPS$02, CPS$03, CPS$04, CPS$05, CPS$06, CPS$07, CPS$08, CPS$09, CPS$10 , CPS$11 , CPS$12 ;
	FROM csprhist WHERE CPPRCD='13605' and cpyear=?ldYear", "c13605")
	
* Product Code 13607
SQLEXEC(lnHandle, "SELECT CPCUST, CPPRCD, CPYEAR, CPS$01, CPS$02, CPS$03, CPS$04, CPS$05, CPS$06, CPS$07, CPS$08, CPS$09, CPS$10 , CPS$11 , CPS$12 ;
	FROM csprhist WHERE CPPRCD='13607' and cpyear=?ldYear", "c13607")
	
* Product Code 22652
SQLEXEC(lnHandle, "SELECT CPCUST, CPPRCD, CPYEAR, CPS$01, CPS$02, CPS$03, CPS$04, CPS$05, CPS$06, CPS$07, CPS$08, CPS$09, CPS$10 , CPS$11 , CPS$12 ;
	FROM csprhist WHERE CPPRCD='22652' and cpyear=?ldYear", "c22652")
	
* Product Code 22653
SQLEXEC(lnHandle, "SELECT CPCUST, CPPRCD, CPYEAR, CPS$01, CPS$02, CPS$03, CPS$04, CPS$05, CPS$06, CPS$07, CPS$08, CPS$09, CPS$10 , CPS$11 , CPS$12 ;
	FROM csprhist WHERE CPPRCD='22653' and cpyear=?ldYear", "c22653")	
	
* Product Code 22654
SQLEXEC(lnHandle, "SELECT CPCUST, CPPRCD, CPYEAR, CPS$01, CPS$02, CPS$03, CPS$04, CPS$05, CPS$06, CPS$07, CPS$08, CPS$09, CPS$10 , CPS$11 , CPS$12 ;
	FROM csprhist WHERE CPPRCD='22654' and cpyear=?ldYear", "c22654")
	
* Product Code 22659
SQLEXEC(lnHandle, "SELECT CPCUST, CPPRCD, CPYEAR, CPS$01, CPS$02, CPS$03, CPS$04, CPS$05, CPS$06, CPS$07, CPS$08, CPS$09, CPS$10 , CPS$11 , CPS$12 ;
	FROM csprhist WHERE CPPRCD='22659' and cpyear=?ldYear", "c22659")
	
* Product Code 22660
SQLEXEC(lnHandle, "SELECT CPCUST, CPPRCD, CPYEAR, CPS$01, CPS$02, CPS$03, CPS$04, CPS$05, CPS$06, CPS$07, CPS$08, CPS$09, CPS$10 , CPS$11 , CPS$12 ;
	FROM csprhist WHERE CPPRCD='22660' and cpyear=?ldYear", "c22660")
	
* Product Code 22661
SQLEXEC(lnHandle, "SELECT CPCUST, CPPRCD, CPYEAR, CPS$01, CPS$02, CPS$03, CPS$04, CPS$05, CPS$06, CPS$07, CPS$08, CPS$09, CPS$10 , CPS$11 , CPS$12 ;
	FROM csprhist WHERE CPPRCD='22661' and cpyear=?ldYear", "c22661") 
 
* Product Code 22680
SQLEXEC(lnHandle, "SELECT CPCUST, CPPRCD, CPYEAR, CPS$01, CPS$02, CPS$03, CPS$04, CPS$05, CPS$06, CPS$07, CPS$08, CPS$09, CPS$10 , CPS$11 , CPS$12 ;
	FROM csprhist WHERE CPPRCD='22680' and cpyear=?ldYear", "c22680")
	
* Product Code 2490
SQLEXEC(lnHandle, "SELECT CPCUST, CPPRCD, CPYEAR, CPS$01, CPS$02, CPS$03, CPS$04, CPS$05, CPS$06, CPS$07, CPS$08, CPS$09, CPS$10 , CPS$11 , CPS$12 ;
	FROM csprhist WHERE CPPRCD='2490' and cpyear=?ldYear", "c2490")
	
* Product Code 33500
SQLEXEC(lnHandle, "SELECT CPCUST, CPPRCD, CPYEAR, CPS$01, CPS$02, CPS$03, CPS$04, CPS$05, CPS$06, CPS$07, CPS$08, CPS$09, CPS$10 , CPS$11 , CPS$12 ;
	FROM csprhist WHERE CPPRCD='33500' and cpyear=?ldYear", "c33500")
	
* Product Code 82113
SQLEXEC(lnHandle, "SELECT CPCUST, CPPRCD, CPYEAR, CPS$01, CPS$02, CPS$03, CPS$04, CPS$05, CPS$06, CPS$07, CPS$08, CPS$09, CPS$10 , CPS$11 , CPS$12 ;
	FROM csprhist WHERE CPPRCD='82113' and cpyear=?ldYear", "c82113")
	
* Product Code 182119
SQLEXEC(lnHandle, "SELECT CPCUST, CPPRCD, CPYEAR, CPS$01, CPS$02, CPS$03, CPS$04, CPS$05, CPS$06, CPS$07, CPS$08, CPS$09, CPS$10 , CPS$11 , CPS$12 ;
	FROM csprhist WHERE CPPRCD='82119' and cpyear=?ldYear", "c82119")
	
* Product Code 82121
SQLEXEC(lnHandle, "SELECT CPCUST, CPPRCD, CPYEAR, CPS$01, CPS$02, CPS$03, CPS$04, CPS$05, CPS$06, CPS$07, CPS$08, CPS$09, CPS$10 , CPS$11 , CPS$12 ;
	FROM csprhist WHERE CPPRCD='82121' and cpyear=?ldYear", "c82121")
	
* Product Code 82140
SQLEXEC(lnHandle, "SELECT CPCUST, CPPRCD, CPYEAR, CPS$01, CPS$02, CPS$03, CPS$04, CPS$05, CPS$06, CPS$07, CPS$08, CPS$09, CPS$10 , CPS$11 , CPS$12 ;
	FROM csprhist WHERE CPPRCD='82140' and cpyear=?ldYear", "c82140")
	
* Product Code 83041
SQLEXEC(lnHandle, "SELECT CPCUST, CPPRCD, CPYEAR, CPS$01, CPS$02, CPS$03, CPS$04, CPS$05, CPS$06, CPS$07, CPS$08, CPS$09, CPS$10 , CPS$11 , CPS$12 ;
	FROM csprhist WHERE CPPRCD='83041' and cpyear=?ldYear", "c83041")
	
*****************************************************************
*::::														::::*
*:::: 	Select Customer Sales by Prod Target Cust JW		::::*
*::::														::::*
*****************************************************************
[+][-]10/29/09 04:18 PM, ID: 25699116Accepted Solution

Your question has an Asker Certified™ answer! jaymz69 verified that this solution worked for them--which means it will likely work for you, too. Click to view the solution free for 30-days now.

About this solution

Zone: FoxPro Database
Sign Up Now!
Solution Provided By: pcelba
Participating Experts: 1
Solution Grade: A
 
 
Loading Advertisement...
20100308-EE-VQP-140 - Hierarchy / EE_QW_3_20080625
Your technology problems solved.
Close See Plans and Pricing. Try it FREE for 30 days.