Hi. I been trying to figure this out on my own, but seems I ran out of ideas.
I have a database like this:
Table Products:
ProductID
ProductName
Table Requirements:
ProductID
RequireID
Table Purchases:
ProductID
Confirm
I want to display each product with its requirements and if the required product was purchased or not. The problem I am facing is that the RequireID and ProductID in Requirements table are the same. Reason for it is that each product I get, I may or may not have to get another one in order for it to work properly, so I want to put a Requirement Product for each one, then display the product with ALL the required products under it, so that I know I have to add those products too, and those products shown with a Yes/No field next to it, basically tells me if I purchased it already or not. Not sure if I explained it right, but I hope so.
This is the display I want to show:
Product:
product XYZ
Requirements:
Product B Yes
Product H No
Product D Yes
Product:
product ABC
Requirements:
Product G No
Product S No
Product L Yes
Here are my statements:
SELECT DISTINCT Products.ProductName, Requirements.RequireID, Purchases.Confirm, Products.ProductID FROM Purchases INNER JOIN (Products INNER JOIN Requirements ON Products.ProductID = Requirements.ProductID) ON Purchases.ProductID = Products.ProductID
The Purchases.Confirm field is the one that has a Yes/No text field which tells if purchased or not. The Requirements.RequireID field has all the products that are needed for each product, separated with a comma (G, S, L, etc).
Here is the table setup:
<table width="100%" border="1" cellspacing="1" cellpadding="2">
<tr bgcolor="#0066FF">
<td width="50%"><div align="center">Name</div></td>
<td width="50%"><div align="right">Code</div></td>
</tr>
<%
While ((Repeat1__numRows <> 0) AND (NOT Files.EOF))
%>
<% If Not Files.EOF Or Not Files.BOF Then %>
<tr>
<td><div align="center"><%=(Files.Fields.Item("ProductName").Value)%></div></td>
<td><div align="right"><%=(Files.Fields.Item("ProductID").Value)%></div></td>
</tr>
<tr>
<td colspan="2"><div align="right">Requirements:
<%=(Files.Fields.Item("RequireID").Value)%></div>
<div align="right"></div></td>
</tr>
<tr>
<td colspan="2"><div align="right"><%=(Files.Fields.Item("Confirm").Value)%></div></td>
</tr>
<tr bgcolor="#000000">
<td colspan="2"> </td>
</tr>
<% End If ' end Not Files.EOF Or NOT Files.BOF %>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
Files.MoveNext()
Wend
%>
</table>
I am trying to make it so that everytime one download takes place, I know I must purchase a different product so that first product will work.
Please let me know if I need to explain more or need anything else.
THANK YOU...
I have a database like this:
Table Products:
ProductID
ProductName
Table Requirements:
ProductID
RequireID
Table Purchases:
ProductID
Confirm
I want to display each product with its requirements and if the required product was purchased or not. The problem I am facing is that the RequireID and ProductID in Requirements table are the same. Reason for it is that each product I get, I may or may not have to get another one in order for it to work properly, so I want to put a Requirement Product for each one, then display the product with ALL the required products under it, so that I know I have to add those products too, and those products shown with a Yes/No field next to it, basically tells me if I purchased it already or not. Not sure if I explained it right, but I hope so.
This is the display I want to show:
Product:
product XYZ
Requirements:
Product B Yes
Product H No
Product D Yes
Product:
product ABC
Requirements:
Product G No
Product S No
Product L Yes
Here are my statements:
SELECT DISTINCT Products.ProductName, Requirements.RequireID, Purchases.Confirm, Products.ProductID FROM Purchases INNER JOIN (Products INNER JOIN Requirements ON Products.ProductID = Requirements.ProductID) ON Purchases.ProductID = Products.ProductID
The Purchases.Confirm field is the one that has a Yes/No text field which tells if purchased or not. The Requirements.RequireID field has all the products that are needed for each product, separated with a comma (G, S, L, etc).
Here is the table setup:
<table width="100%" border="1" cellspacing="1" cellpadding="2">
<tr bgcolor="#0066FF">
<td width="50%"><div align="center">Name</div></td>
<td width="50%"><div align="right">Code</div></td>
</tr>
<%
While ((Repeat1__numRows <> 0) AND (NOT Files.EOF))
%>
<% If Not Files.EOF Or Not Files.BOF Then %>
<tr>
<td><div align="center"><%=(Files.Fields.Item("ProductName").Value)%></div></td>
<td><div align="right"><%=(Files.Fields.Item("ProductID").Value)%></div></td>
</tr>
<tr>
<td colspan="2"><div align="right">Requirements:
<%=(Files.Fields.Item("RequireID").Value)%></div>
<div align="right"></div></td>
</tr>
<tr>
<td colspan="2"><div align="right"><%=(Files.Fields.Item("Confirm").Value)%></div></td>
</tr>
<tr bgcolor="#000000">
<td colspan="2"> </td>
</tr>
<% End If ' end Not Files.EOF Or NOT Files.BOF %>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
Files.MoveNext()
Wend
%>
</table>
I am trying to make it so that everytime one download takes place, I know I must purchase a different product so that first product will work.
Please let me know if I need to explain more or need anything else.
THANK YOU...