|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
A little Newbie help
Hello everyone,
I am new to SQL and was wondering if any of you could offer advice for the following problem. I have 4 tables in Access, they are listed below: Table1 StyleID AttID AttributeValue 1 1 (a) 1 2 72 1 3 0 1 4 0 1 5 0 1 6 0 2 1 <Null> 2 2 72 2 3 0 2 4 36 2 5 3 2 6 0 2 7 12 3 1 <Null> 3 2 0 3 3 0 3 4 0 3 5 0 3 6 0 3 7 0 Table2 ID StyleName StyleType StyleString 1 @Normal 2 2 "_1.0sp 0.5""" 1 3 _Author Data Left 2 Table3 TypeID AttributeID 1 1 1 2 1 3 1 4 1 5 2 2 2 3 2 4 2 5 2 7 What I would like to ultimately do is create a string value in Table 2 that would concatenate the applicable attribute values from table 1 based on the typeID and attributeID in table 3. It should look something like this: ID StyleName StyleType StyleString 1 @Normal 2 72|0|0|0| 2 "_1.0sp 0.5""" 1 (a)|72|0|0|0| 3 _Author Data Left 2 0|0|0|0| Any help would be appreciated! Thanks! Last edited by got2bmvp : May 13th, 2004 at 09:25 PM. |
|
#2
|
|||
|
|||
|
i think you are going to have to use a JOIN command to join the tables when doing a query... maybe even a ... hmm. forget the term ... where you select portions of each table useing the join but it makes a seperate table not just a query
...I am new at this too... just a sugestion to try ![]() |
|
#3
|
|||
|
|||
|
|
|
#4
|
|||
|
|||
|
Finally got it....
SELECT DISTINCT StyleAttributes.AttributeValue, Apply.AttributeID FROM StyleAttributes, StyleNames, Apply, Templates WHERE Apply.StyleTypeID = StyleNames.StyleTypeID AND StyleNames.ID = StyleAttributes.StyleNameID AND Apply.AttributeID = StyleAttributes.AttributeID AND StyleNames.StyleName = 'WhatStyle' AND Templates.ID = WhatTemplate ORDER BY Apply.AttributeID
Thanks |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > A little Newbie help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|