Referencing joined table
2 posts by 1 authors in: Forums > CMS Builder
Last Post: September 21, 2010 (RSS)
By MisterJim - September 21, 2010 - edited: September 21, 2010
Is it possible to reference a column in a table that is joined using the joinTable statement?
Here's my code:
It runs and pulls the titles that I want out of the music_tracks table, but unfortunately it pulls ALL the titles out of the music_tracks table and not just the ones that I want (where 'track' in music_tracks equals 'track' in cd_tracks.
Should I be using joinTable or do I have to write custom SQL?
Jim
Here's my code:
list($music_tracksRecords, $music_tracksMetaData) = getRecords(array(
'tableName' => 'music_tracks',
'joinTable' => 'cd_tracks',
'where' => 'cd_tracks.media =' . $mediaRecord['num'] AND 'music_tracks.num = cd_tracks.track',
));
It runs and pulls the titles that I want out of the music_tracks table, but unfortunately it pulls ALL the titles out of the music_tracks table and not just the ones that I want (where 'track' in music_tracks equals 'track' in cd_tracks.
Should I be using joinTable or do I have to write custom SQL?
Jim
WebCamp One, LLC
Websites That Work
Websites That Work
Re: [Mr Jim] Referencing joined table
By MisterJim - September 21, 2010 - edited: September 21, 2010
Never mind. I figured it out-- but I'll leave my question, and this answer, for anyone else who might run into the same type of trouble.
The answer was to NOT use joinTable, but to instead use a leftJoin. Dave explains this in the following post:
http://tinyurl.com/22pamfz
Jim]
The answer was to NOT use joinTable, but to instead use a leftJoin. Dave explains this in the following post:
http://tinyurl.com/22pamfz
Jim]
WebCamp One, LLC
Websites That Work
Websites That Work