Hello !

A simple question, but it seems the answer will be complex (or simply "no")...

I have some custom modules which works together... The first is a sort of cck field, but not completely. It allow user to upload pictures, define a "content_picture" table to store links between two content types : album and picture. each content type defind a table to store some informations :
album :
- nid,
- aid (albumid, same as nid),
- overview,
- ...

picture :
- nid,
- pid (pictureid, same as nid),
- fid (linked uploaded file),
- ...

Album content type embed the cck field to upload, and each upload generate a "picture" content type. Result are stored in the content_picture table.
content_picture :
- pid (pictureid),
- nid (albumid),
- type,
- delta,
- created,
- changed,
- ...

Now, I would like to create views to get all pictures from an album. Album id is passed as argument ([nid-argument]) to the view, and I create a "relationship handler" to link album, content_picture and pictures data.

My problem is the following : I would like to use the argument in the "join" clause of my query, but the result query always use the argument in the where clause.

here is the actual result query :

SELECT node.nid AS nid FROM node node  
LEFT JOIN picture picture ON node.nid = picture.nid 
INNER JOIN content_picture content_picture_node ON node.nid = content_picture_node.pid 
WHERE node.nid = [nid-argument]

And I would like to have the following query :

SELECT node.nid AS nid FROM node node  
LEFT JOIN picture picture ON node.nid = picture.nid 
INNER JOIN content_picture content_picture_node ON node.nid = content_picture_node.pid 
AND content_picture_node.nid = [nid-argument]

Like you can see, the argument must be linked with the content_picture.nid field instead of the node.nid field, but I don't understand how to alter the query directly in my relationship_handler to get the correct query...

If anyone can point me a right way to do it, it would be very helpful.

Thanks in advance for any suggestion :-)