> Hello christoph
> The error you recieve is for typo.
> Use uppercase model name as aliased in the query
> >>>>>>> $criteria = 'Collection.user_id  = \'' .  $uid . '\'';

Thanks for your response.  But typo aside, the query isn't going to
return the result set I'm expecting.  If there are 0 rows for the user
in the collections table, 0 rows from the game_pieces table are going
to be returns.  Or, only those rows from game_pieces that have a
matching game_piece_id in the collections table.  I want all rows from
game_pieces and also the associated data from collections, where
applicable.  Basically, Cake is creating this query (type aside):

SELECT `GamePiece`.`id`, `GamePiece`.`games_set_id`,
`GamePiece`.`piece_name`, `GamePiece`.`piece_type`,
`GamePiece`.`piece_sub_type`, `GamePiece`.`piece_description`,
`GamePiece`.`piece_flavor_text`, `GamePiece`.`piece_artist`,
`GamePiece`.`piece_rarity`, `GamesSet`.`id`, `GamesSet`.`game_id`,
`GamesSet`.`set_id` FROM `game_pieces` AS `GamePiece` LEFT JOIN
`games_sets` AS `GamesSet` ON `GamePiece`.`games_set_id` =
`GamesSet`.`id` WHERE `Collection`.`user_id` = 'joebob' ORDER BY
`GamePiece`.`id` ASC LIMIT 10

When I need it to create this query:

SELECT `GamePiece`.`id`, `GamePiece`.`games_set_id`,
`GamePiece`.`piece_name`, `GamePiece`.`piece_type`,
`GamePiece`.`piece_sub_type`, `GamePiece`.`piece_description`,
`GamePiece`.`piece_flavor_text`, `GamePiece`.`piece_artist`,
`GamePiece`.`piece_rarity`, `GamesSet`.`id`, `GamesSet`.`game_id`,
`GamesSet`.`set_id` FROM `game_pieces` AS `GamePiece`
LEFT JOIN `games_sets` AS `GamesSet` ON `GamePiece`.`games_set_id` =
`GamesSet`.`id`
LEFT JOIN `collections` ON `collections`.`user_id` = 'joebob' AND
`GamePiece`.id = `collections`.game_piece_id
ORDER BY `GamePiece`.`id` ASC LIMIT 10

See the difference?  It's taking the criteria I specify (user_id) and
is using it as part of the WHERE clause when I need it to use it as
part of the LEFT JOIN that is applicable to that particular model.

thnx,
Christoph


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to