[TYPO3-mvc] JOIN
Christian Tauscher
christian.tauscher at media-distillery.de
Tue May 19 10:06:35 CEST 2015
Hello dear developers.
The fear of me is JOIN. Never understood this really, so i'd like your help.
My Example (tt_address->extbaseMapping is assuned to work correctly):
tt_address:
UID, Name, Group;Group...(groups names are uid, just for better reading)
3, Company1, Farbe;deutschland
5, Company2, deutschland;Maschine
I'd like to write a filter, AND connected:
Give me all addresses whit group "deutschland"
-> 3,5
Give me all addresses whit group "deutschland" AND "Farbe"
-> 3
SELECT DISTINCT uid, company FROM tt_address INNER JOIN
tt_address_group_mm ON tt_address.uid = tt_address_group_mm.uid_local
WHERE tt_address_group_mm.uid_foreign IN('deutschland','farbe')
-> 3,5
But I expect only id3
Try this:
WHERE
tt_address_group_mm.uid_foreign = 'farbe' AND
tt_address_group_mm.uid_foreign = 'deutschland'
-> NULL
I still expect id3...???
Of course I bild thois first with $query->matching... wich leads to the
exact same result.
$part[] = $query->equals('addressgroup.uid', 'deutschland');
$part[] = $query->equals('addressgroup.uid', 'farbe');
$query->matching($query->logicalOr($part));
-> 3,5
seems extbase build some very close to my SELECT.
If I change this to logicalAnd, then I get no result.
If you see my mistake, please let me know.
Thank you for your help,
Christian.
More information about the TYPO3-project-typo3v4mvc
mailing list