Here is the first query which finds me unique catalog ids
in a table. Basically, I have a table of watch styles.
These include "FUN", "COOL", "HITECH", "ELEGANT" and so
forth. I have another table of WATCHES which include the
catalogid and other detailed information about each WATCH
item. I then have another table which establishes the
relationship between a watch catalogid and a styleid. In
other words, any particular watch could be "FUN", "COOL"
and "HITECH". So therefore the watchesstyles table is a
two column table consisting of catalogids and styleids
relating each watch to the styles it is considered to be.
I need a browser on the internet to look for all watches
that are "COOL" and/or "FUN". I need to find the DISTINCT
catalogids which meet that criteria. I then need to join
the results of that query with my detailed description of
each watch in order to present the browser with detailed
product information.
1. QUERY1 - Find catalogids for qualifying styles.
SELECT DISTINCT watchesstyles.catalogid
FROM watchesstyles
WHERE (((watchesstyles.styleid)=5))
2. Take the results of QUERY1 and join it with the watch
details table.
SELECT Query1.*, watches.*
FROM Query1 INNER JOIN watches ON Query1.catalogid =
watches.catalogid
How do I do this with VBScript commands?
Here is how I normally pull data out:
If IsObject(Session("mmwatches_conn")) Then
Set conn = Session("mmwatches_conn")
Else
Set conn = Server.CreateObject("ADODB.Connection")
conn.open "mmwatches","admin",""
Set Session("??mmwatches_conn") = conn
End If
sql = "SELECT DISTINCT watchesstyles.catalogid FROM
watchesstyles WHERE (((watchesstyles.styleid)=5)) "
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sql, conn, 3, 3
If rs.eof Then
rs.AddNew
End If
Thanks in advance for your help.
Tom Shubert
Quote:>-----Original Message-----
>Can you post the CREATE TABLE statements, a few sample
data and the
>expected results as a list?
>--
>- Anith
>(Please respond only to newsgroups)
>.