| |
sr_aneesh
Posts: 2
Score: 0
Joined: 8/5/2004
From:
Status: offline
|
i have two tables color and cloths. The Data in color Table are : id Color 1 Red 2 Orange 3 Yellow 4 pink 5 white Data in Cloths table are like Clothid Size Color Cost 1 XL 1,4,3 450 2 L 2,5 650 3 X 2,3,5 200 The color field in Cloths table is the id in the color table that means Clothid 1 has a XL size cloths of Red,Pink,Yellow (1,4,3) now i want when i view the data, instead of the colorids in the cloths table the colorname should appear that means insaed of 1,4,3 i want Red,Pink,Yellow. i think the best way is through function what function should i write to do so. i wrote something like this which gave error. pls rectify. what are the other methods to come up with the said result. <% sqlcolor="select * from color" set rscolor=conn.Execute(sqlcolor) sqlt="select id,size,color from cloth" set rs=conn.Execute(sqlt) %> Function showcolor(i,w) t=split(i,",") for u= 0 to ubound(t) for s =0 to ubound(w) if t(u)=w(s) then replace(t(u),w(1)) end if next next End Function <%showcolor(rs(2),rscolor)%>
|
|