Problems combining two queries

zyxwvu44

Registered User.
Local time
Yesterday, 22:03
Joined
Jul 19, 2007
Messages
36
Hello again,

I am trying to have users be able to see and enter comments on a form along with results from a query. My database looks like this:
my.php


the "comments" table is what i'm having problems with. Right now i have a query where a user selects a product and any number of funds and it returns the Counterparties that meets the criteria based on the "Combine" table. This works great, but due to the combine table using the counterparty entity I can't figure out how to relate the comments. I am using counterparty entity in the combine table because some users will need the more specific information.

I have tried linking the Comments table to the counterparty table and the products table, but this poses the problem of updatablility and entering too much useless data. If i did it this way each entry of a comment could have to be repeated 5-10 times(for each entity). Also if there are no entries for a certain counterparty any query i make will either come up with nothing or it just repeats the comment entries i do have.

I have also tried putting the comments in the Combine table, but this poses a similar problem because of multiple entities per counterparty.

So, what I'm looking for is a way to match up comments to a single product and a list of counterparties in a continuous results form. Also i want the user to be able to edit each comment ON the results form(does this mean it has to be directly linked to the table?).

I tried researching updating multiple similar fields(one entry updates all the entities of a counterparty for a product), which may solve the problem, but i found nothing. Any ideas?

Thanks!
 
Don't think your database design is correct. Having said that, to what do you want to comment about? To products or counterparties?
 
I want to comment on a counterparty given a certain product. so, counterparty A and product X have a comment, counterparty B and product X have a comment, counterparty A and product Y have a comment, etc.
 
Add an autonumber field to the combine table. This will be your reference in the comments table instead of product and counterparty. Remove these fields.
 
I figured it out, had to set more indexes and rearrange my relationships, thanks
 

Users who are viewing this thread

Back
Top Bottom