June 21st, 2002, 04:22 PM
I have a database with a products table, colors table and product colors table. I have created a SQL statement to extract the colors associated with a specific product based on ProductID. I am having a problem figuring out how to get the product name to show one time and then fill a select box with each color. Any help would be appreciated. Thank you.
sql = "SELECT DISTINCT Products.ProductName, Colors.ColorDescription FROM Products INNER JOIN (Colors INNER JOIN ProductColors ON Colors.ColorID = ProductColors.ColorID) ON Products.ProductID = ProductColors.ProductID WHERE Products.ProductID = " & id & ";"
Current ASP Code that repeats the product name with each color:
<% While Not objRec.EOF %>
<td valign="top"><a href="productdetail.asp?ProductID=<%= objRec("ProductName") %>"><%= objRec("ProductName") %></a></td>
<td valign="top"><%= objRec("ColorDescription") %></td>
June 25th, 2002, 08:46 AM
count = 1
While Not objRec.EOF
if count = 1 then
..... code for the first time here
.... code for the rest of the times here
count = count + 1
June 25th, 2002, 09:07 AM
Thanks for the reply. I did something like that and it works fine. Now I just need to figure out how to get another parameter working - size. I think I am going to try a group by statement.