Shaping data/multiple result sets - hmmm...

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top