473,499 Members | 1,568 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SHAPED SQL: Need help!

1 New Member
Hi All,
I have very complex database and I am trying to build an Shaped SQL string with no success. Could anyone help me to answer how this would look like.
TABLE LIST:
Asset, Structure, Element, History

SQL should look like:
Lets make shorter Table Names:
Asset as A
Structure as S
Element as E
History as H

Then,
[TABLE: A]
At.A_ID
H.History (WHERE A.A_ID=H.A_ID AND H.S_ID=0 AND H.Element_ID=0 AND H.Type=0) ' Multiple records

[TABLE: S] 'Multiple Records
S.A_ID (WHERE A.At_ID=S.A_ID) 'Multiple Records
H.H (WHERE S.A_ID=H.A_ID AND S.S_ID=H.S_ID AND H.E_ID=0 AND H.Type=1) ' Multiple Records
H.H (WHERE S.A_ID=H.A_ID AND S.S_ID=H.S_ID AND H.E_ID=0 AND H.Type=2) ' Multiple Records
H.H (WHERE S.A_ID=H.A_ID AND S.S_ID=H.S_ID AND H.E_ID=0 AND H.Type=3) ' Multiple Records

[TABLE: E] 'Multiple Records
E.A_ID (WHERE S.At_ID=E.A_ID AND S.S_ID=E.S_ID) 'Multiple Records
H.H (WHERE E.A_ID=H.A_ID AND E.S_ID=H.S_ID AND H.E_ID=E.E_ID AND H.Type=1) ' Multiple Records
H.H (WHERE E.A_ID=H.A_ID AND E.S_ID=H.S_ID AND H.E_ID=E.E_ID AND H.Type=2) ' Multiple Records
H.H (WHERE E.A_ID=H.A_ID AND E.S_ID=H.S_ID AND H.E_ID=E.E_ID AND H.Type=3) ' Multiple Records


DATA EXAMPLE:

TABLE A
[A.A_ID] [A.REF]
10 REF1
20 REF2


TABLE S
[S.A_ID] [S.S_ID]
10 100
10 200
20 100


TABLE E
[E.A_ID] [E.S_ID] [E.S_ID]
10 100 1
10 100 2
10 200 1
10 200 2
20 100 1

TABLE H
[H.A_ID] [H.S_ID] [H.E_ID] [H.TYPE] [H.HISTORY]
10 0 0 0 "1 THIS IS A HISTORY 10-0-0 T0" 'History of A=10, Type=0
10 0 0 0 "2 THIS IS A HISTORY 10-0-0 T0" 'History of A=10, Type=0
20 0 0 0 "1 THIS IS A HISTORY 20-0-0 T0" 'History of A=20, Type=0

10 100 0 1 "1 THIS IS S HISTORY 10-100-0 T1" 'History of S=100, Type=1
10 100 0 1 "2 THIS IS S HISTORY 10-100-0 T1" 'History of S=100, Type=1
10 100 0 2 "1 THIS IS S HISTORY 10-100-0 T2" 'History of S=100, Type=2
10 100 0 3 "1 THIS IS S HISTORY 10-100-0 T3" 'History of S=100, Type=3

10 200 0 1 "1 THIS IS S HISTORY 10-200-0 T1" 'History of S=200, Type=1
10 200 0 2 "1 THIS IS S HISTORY 10-200-0 T2" 'History of S=200, Type=2
10 200 0 3 "1 THIS IS S HISTORY 10-200-0 T3" 'History of S=200, Type=3

10 100 1 0 "1 THIS IS E HISTORY 10-100-1 T0" 'History of E=1, Type=0
10 100 1 1 "2 THIS IS E HISTORY 10-100-1 T1" 'History of E=1, Type=1
10 200 1 1 "1 THIS IS E HISTORY 10-200-1 T1" 'History of E=1, Type=1
10 100 1 2 "1 THIS IS E HISTORY 10-100-2 T2" 'History of E=1, Type=2
10 100 1 3 "1 THIS IS E HISTORY 10-100-3 T3" 'History of E=1, Type=3

And so on...

OUTPUT SHOULD LOOK LIKE:

A_ID=10
H.H="1 THIS IS A HISTORY 10-0-0 T0"
H.H="2 THIS IS A HISTORY 10-0-0 T0"
<...>
S.S_ID=100
'TYPE=0
H.H="1 THIS IS S HISTORY 10-100-0 T0"
H.H="2 THIS IS S HISTORY 10-100-0 T0"
<...>
'Type=2
H.H="1 THIS IS S HISTORY 10-100-0 T2"
<...>
'Type=3
H.H="1 THIS IS S HISTORY 10-100-0 T3"
<...>

E.E_ID=1
'Type=0
H.H="1 THIS IS E HISTORY 10-100-1 T0"
<...>
'Type=1
H.H=
<...>
'Type=2
H.H=
<...>

E.E_ID=2
'Type=0
H.H=
<...>
'Type=1
H.H=
<...>
'Type=2
H.H="1 THIS IS E HISTORY 10-100-2 T2"
<...>

<...>

S.S_ID=200
'TYPE=0
H.H="1 THIS IS S HISTORY 10-200-0 T0"
<...>

<...>

<...>

A_ID=20
H.H="1 THIS IS A HISTORY 20-0-0 T0"

Currently mys SQL looks like:

SQLCond = "IN (110154023, 123123228)"
sql = "SHAPE {SELECT * FROM [Asset] WHERE [ASSET_ID] " & SQLCond & "} As Asset " & _
"APPEND ((SHAPE {SELECT Asset_ID,Structure_ID,Element_ID,hType,History,Add ed,UserName FROM [History]" & _
"WHERE htype=" & hAsset & " AND [ASSET_ID] " & SQLCond & "} As History " & _
"APPEND {SELECT Asset_ID,Structure_ID,Element_ID,hType,History,Add ed,UserName FROM [History]" & _
"WHERE htype=" & hAssetMaintenance & " AND [ASSET_ID] " & SQLCond & "} As Structures)"

and gives me a syntax error at the very end: "...IN (110154023, 123123228)} As Structures)"

Thank for any kind of help!
Feb 20 '07 #1
0 1064

Sign in to post your reply or Sign up for a free account.

Similar topics

5
2536
by: vBOT | last post by:
Hi all, I have an odd shaped graphic I would like to use as my interface (see it here at http://www.mokee.com/vbot/ver3/face.jpg) The part I want to be transparent on the image is red. I set the...
3
3302
by: James | last post by:
I have an picture cut out in a certain shape that I would like to make as my form. I have tried following the directions in MSDN on how to make shaped windows forms but their directions did not work...
2
1890
by: Flix | last post by:
I need some help to handle the Region property of my Form in the correct way. Usually when I create shaped forms in my programs, I modify the Form.Region property, making it include only a part of...
4
2457
by: Publicjoe | last post by:
Hi guys, I am writing an app that I wish to have a transparent background and hence a shaped form. In the InitializeComponent() method I set the members of the form to the following: //--...
0
1658
by: dr | last post by:
C# Irregular shaped user controls. How to make usercontrol have transparency key for its background image? I want to have irregular shaped user controls on my form. like a funny shaped button....
1
18947
by: striker07 | last post by:
Someone help me how can i display a diamond shaped asterisk correctly pls. correct my program this is my code: Dim ctr, space, asterisk As Integer For ctr = 1 To 9 Step 2 For space = (9...
1
3540
by: PankajGaur | last post by:
Hi, I need to create a Ellipse shaped user control which have folloiwng attributes: 1) The edges are smooth 2) The control shuld only be selected when click on the ellipse shape & not when...
0
1364
by: =?Utf-8?B?UGFua2FqR2F1cg==?= | last post by:
Hi, I need to create a Ellipse shaped user control which have folloiwng attributes: 1) The edges are smooth 2) The control shuld only be selected when click on the ellipse shape & not when...
3
2281
vdraceil
by: vdraceil | last post by:
Hi everyone,i just wanted to know whether it is possible to hav different shaped command buttons in VB6.0?-i mean using oval shaped buttons,star shaped buttons,something like that in my forms just to...
0
7223
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6899
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7390
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5475
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4919
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4602
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3094
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1427
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.