Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE development » Application Development » Compound foreign keys in linking tables (Can I create a LINK1 between two tables where one or both of the tables have compound primary keys?)
Re: Compound foreign keys in linking tables [message #4934 is a reply to message #4930] Wed, 26 August 2015 05:31 Go to previous messageGo to previous message
AJM is currently offline  AJM
Messages: 2347
Registered: April 2006
Location: Surrey, UK
Senior Member
Unlike some other frameworks, RADICORE does not expect primary keys to be limited to a single column, so it should not have any difficulty in handling compound primary keys as well as compound foreign keys.

The SQL query that the LINK1 pattern tries to build is shown at http://www.tonymarston.net/php-mysql/many-to-many.html#a5b such as
SELECT a.a_id, b.b_id, b.b_desc,  
CASE WHEN x.b_id IS NULL THEN 'F' ELSE 'T' END AS selected 
FROM a 
CROSS JOIN b 
LEFT JOIN x ON (x.a_id = a.a_id AND x.b_id = b.b_id) 
WHERE (a.a_id = 'whatever')

What you need to do first is to build an equivalent query for your table structure, then try it out in your database client (phpMyadmin or HeidiSQL or whatever). When you get this working you should then see what query RADICORE builds by default. You will only need to take corrective action if the query is not correct. You certainly should not have to use CONCAT to construct a dummy primary key containing a single field.


 
Read Message
Read Message
Read Message
Previous Topic: Choose null on add3 popup
Next Topic: How to provide choices for two compound foreign keys in a form?
Goto Forum:
  


Current Time: Mon Apr 29 01:39:47 EDT 2024

Total time taken to generate the page: 0.01013 seconds