M
Mike Kingscott
Hi all,
I wonder if anyone can help? I have a need to display some data on my
web page (the results of a search) for links. Here's the thing: Each
link can belong to one or more category (yes, I have a many-to-many
table). When the links are retrieved, I also want to retrieve the
categories the link is found in.
Let's say link A appears in categories X, Y, and Z, and a keyword
search brings back link A - due to the way the query is structured
(inner join), link A is retrieved three times due to it's presence in
categories X, Y, and Z.
The question is: How do I retrieve the categories (of which there may
be 1 or more for each link) along with the link? Or can't I?
I was thinking of multiple selects in a stored procedure (so they
could be put into separate dataset tables), but that would need some
correlation between the links found in the first query (i.e. the one
that finds the links) and the second (the one that retrieves the
categories for the links that have been found).
Alternatively, I could just cache the category table, along with the
LinkToCategory table and as I'm writing each entry to the page, look
up the corresponding category then - if I'm using a DataRepeater, I
think I can use the Item_Created event...
However, I don't really want to do that, I'd rather do it at the
database level. Any thoughts?
Kind regards,
Mike K.
I wonder if anyone can help? I have a need to display some data on my
web page (the results of a search) for links. Here's the thing: Each
link can belong to one or more category (yes, I have a many-to-many
table). When the links are retrieved, I also want to retrieve the
categories the link is found in.
Let's say link A appears in categories X, Y, and Z, and a keyword
search brings back link A - due to the way the query is structured
(inner join), link A is retrieved three times due to it's presence in
categories X, Y, and Z.
The question is: How do I retrieve the categories (of which there may
be 1 or more for each link) along with the link? Or can't I?
I was thinking of multiple selects in a stored procedure (so they
could be put into separate dataset tables), but that would need some
correlation between the links found in the first query (i.e. the one
that finds the links) and the second (the one that retrieves the
categories for the links that have been found).
Alternatively, I could just cache the category table, along with the
LinkToCategory table and as I'm writing each entry to the page, look
up the corresponding category then - if I'm using a DataRepeater, I
think I can use the Item_Created event...
However, I don't really want to do that, I'd rather do it at the
database level. Any thoughts?
Kind regards,
Mike K.