1
Hi, I have a photo album creation table. My code makes 1 Insert for each image added in the photo album. I have a grid for displaying Albums for the user to view. I want to make a distinct of duplicate albuns.
I have this kind of code:
$select = Doctrine_Query::create()
->select('DISTINCT s.idAlbum')
->addSelect('s.imagens_data, s.publicar')
->from('tbimagens s')->getSqlQuery();
print_r($select);
die;
This is my Sql result:
SELECT DISTINCT
t.id AS t__id,
t.idalbum AS t__idalbum,
t.imagens_data AS t__imagens_data,
t.publicar AS t__publicar
FROM tbimagens t
Did you see that select brings the table Id ? This Id is making it impossible for me to make the correct select because all Ids are already naturally distinct.
Can someone help me with this query? I’m using symfony 1.4 and Doctrine 1.2
What is your criteria for deciding whether an album is duplicated or not?
– Rodrigo Rigotti
if the number of times it appears on the grid is greater than the number of images uploaded to it.
– Estácio Di Fabio