Hi!
>Hi Andrew,
>
>If you can explain your first idea more detailed, it would be great.
Nadya, it looks like you don't know RDBMS theory well ;) Sorry, just kidding. I will try to explaing it by easy way.
In RDBMS theory many-to-many relationship should be established by using separate additional table to preserve third normal form of database. For example:
Customer
Cust_id name address
Product
prod_id name description
Many-to-many relationship will be done using third table
CustProd
Cust_id Prod_id date_bought
As you see, this way allows also add some additional information. You way will look here like following:
Customer
Cust_id name address mapto='A8', 'BCD' etc.
Product
prod_id = 'A', '8', 'B' etc.
Do you see difference?
Anyway, seems you will not accept such database changes because you already have a lot of data, as you said. In addition, third notmal form for Many-to-many relationship is good for flexibility, but bad for queries. Your query in such case for 'AND' will look like following:
Select * from Customers
Where cust_id IN (select cp.cust_id from CustProd cp inner join products p
on p.prod_id = cp.prod_id where prod_id = 'A')
AND cust_id IN (select cp.cust_id from CustProd cp inner join products p
on p.prod_id = cp.prod_id where prod_id = '8')
Nice, heh? I don;t know about speed, however. Last query definitely will run more quickly on SQL server, but will be slower with VFP database through network because plenty of indexes for optimization.
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.comICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs
It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.