Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 records repeating with outerjoin

Author  Topic 

meeta
Starting Member

45 Posts

Posted - 2001-09-27 : 17:47:55
I'm using acess db. There are 3 tables.
products = prodid(autonumber), prodname, model, etc..
options = opid(autonumber), opname, price, etc..
options_prodapp = popid, prodid (this table is used to store options which would be applied to different products so popid can be in more than one rows. So is prodid, as same prodid can be applied to more than one option. )

select * from options left outer join options_prodapp on options.opid = options_Prodapp.popid

when options_Prodapp.popid is not null and options_prodapp.prodid = id then optionnameic checked. & How can I avoid optionnam listed as many times as they appear in options_prodapp table foreg:

options
opid opname
1 op first
2. op second
3. op third

optoins_prodapp
popid prodid (represents prodcutid)
1 11
2 11
2 12
1 13


In my form fro product id 13 it should dislpay as
op first [checked ] op second [ ] op third [ ]


my asp code is like

<%
'sql = "select * from options left outer join options_prodapp on options.opid = options_Prodapp.popid where options_prodapp.prodid = " & cint(id)
sql = "select * from options left outer join options_prodapp on options.opid = options_Prodapp.popid "
set rs = conn.execute (sql)
while not rs.eof
%>
<INPUT TYPE=CHECKBOX name=options value=<%= rS("opid")%>
<% if NOT isNULL(rs("popid") ) and rs("prodid") = cint(id) then response.write " CHECKED " %>> <%= rS("opname") %>
<%
rs.movenext
wend
%>

thanks in advance




   

- Advertisement -