troubleshooting Question

SQL,delphi2010

Avatar of hrvica5
hrvica5Flag for Croatia asked on
DelphiMicrosoft SQL Server 2008
15 Comments1 Solution461 ViewsLast Modified:
Hi guys i have big problem if you can help me.

I HAVE TO GET THIS TABLE:

RESULT TABLE
TRZ      N_TRZ   KON    N_KON     2011
-----------------------------------------
1001     DOOOO   2300   EXP2       300
1001     DOOOO   7500   EXP         400    
1001     DOOOO   7510   EXP1       200
1002     DOOOO   7500   EXP         200  
1002     BOOOO   2300   EXP         100
1002     BOOOO   7411   EXP3      1000
1002     BOOOO   7510   EXP1        400
1002     BOOOO   7511   EXP4       1500
1002     BOOOO   7561   FXP6        100




AND I HAVE TO USE THESE TABLES TO GET TABLE UP?

TABLE 1
DATE          TRZ     VRS   VRSR   CASH
------------------------------------------------------
05.01.11      1001      F                      100
13.02.11      1001      K                      100
05.03.11      1001      L                      100
12.04.11      1002      F                      100
05.05.11      1002      F                      100
05.05.11      1002      _         B           100
05.05.11      1002      _         H           100
05.11.11      1001      D                      100
05.11.11      1002      K                       200
15.01.11      1001      D                      100
23.03.11      1001      N                      100
05.01.11      1002      K                      200
28.04.11      1001      F                      100
05.01.11      1002      V                     1000
17.06.11      1001      F                       100
05.01.11      1002      H                     1500
16.01.11      1001      F                       100
12.03.11      1001      N                       100

TABLE 2
KON    N_KON
--------------
2300   EXP2
7500   EXP
7411   EXP3
7510   EXP1
7511   EXP4
7561   FXP6

TABLE 3
VRS   KON
------------
F     7500
L     7500
K     7510
D     2300
N     2300
V     7411
H     7511
B     7610

TABLE 4
TRZ    N_TRZ
--------------
1001   DOOOO
1002   BOOOO  

IF YOUL LOOK IN TABLE 1 YOU WILL SEE THAT THERE ARE SOMEWHERE IN FIELD
"VRS" VALUE "_"
IF THE VALUE IS "_" THEN IT SHOULD LOOK IN FIELD VRSR TO SERACH IN TABLE 3
FOR "KON".

AND I HAVE ONE MORE PROBLEM I HAVE CHECKBOXES FOR YEARS
FOR EXAMPLE 2009, 2010, 2011.
IF I CHECK FOR EXAMPLE 2009, 2010 AND 2011 THE TABLE SHOULD LOOK LIKE THIS
TABLE 5
AND THESE TABLES (TABLE 1)ARE IN ANOTHER DATABASESAND ARE CALLED
and these
dabases are called (KUPID09, KUPID10, KUPID11), AND OTHER TABLES
(TABLE 2, TABLE 3, TABLE 4) ARE SAME IN EVERY DATABASE.

TABLE 5
TRZ      N_TRZ   KON     N_KON     2009  2010  2011
---------------------------------------------------------------------
1001     DOOOO   7500   EXP                               400    
1001     DOOOO   7510   EXP1                             200
1001     DOOOO   2300   EXP2                             300
1002     DOOOO   7500   EXP                               200  
1002     BOOOO   7411   EXP3                            1000
1002     BOOOO   7510   EXP1                              400
1002     BOOOO   7511   EXP4                            1500
1002     BOOOO   7561   FXP6                              100
1002     BOOOO   2300   EXP                                100

and values hve to be in fileds 2009, 2010

I DON'T KNOW HOW TO SOLVE BUT I WOULD BE GRATEFUL IF YOU CAN MANAGE IT,
THX A LOT guys

P.S. HOPE YOU UNDERSTAND WHAT I WROTE
       This is more sql then delphi.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 15 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 15 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros