Log message #4032957

# At Username Text
# May 26th 2017, 15:46 iqu in controller?
# May 26th 2017, 15:45 iqu my brain is littlebit slow now..
# May 26th 2017, 15:44 hmic is it Users.id or Orders.id
# May 26th 2017, 15:43 hmic qualify the id
# May 26th 2017, 15:43 iqu hmic: sry, dont understand?
# May 26th 2017, 15:43 hmic iqu, specify the table!
# May 26th 2017, 15:41 iqu any easy fix: Error: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'id' in order clause is ambiguous
# May 26th 2017, 15:33 hmic so: conditions => ['Bids.user_id = OtherBids.user_id', ... ] instead of conditions => [ 'Bids.user_id' => 'OtherBids.user_id', ... ] will do.
# May 26th 2017, 15:32 styks1987 ok super thanks
# May 26th 2017, 15:31 hmic but, like i said, you can provide them in one string instead of key => value pairs and it will work
# May 26th 2017, 15:31 hmic there is no option available to do so if you are using the "conditions" array notation IMHO, only when using ->where()
# May 26th 2017, 15:31 hmic you do need to tell the orm that the values in your array are not values but identifiers
# May 26th 2017, 15:30 hmic you do not need to change them
# May 26th 2017, 15:30 hmic it gets them from the schema automatically
# May 26th 2017, 15:29 styks1987 ok, do you know where the default types are defined? I don’t know what type to use? I see examples for integer
# May 26th 2017, 15:26 hmic remember: use leftJoinWith ;-)
# May 26th 2017, 15:26 hmic it's not available if you use the 'conditions' key in a join definition
# May 26th 2017, 15:26 hmic its the second parameter to ->where()
# May 26th 2017, 15:24 styks1987 I don’t see that type int he docs
# May 26th 2017, 15:24 styks1987 hmic: how would I specify no value? I’d like to keep the array
# May 26th 2017, 15:23 styks1987 oh, but it made it a string… yea ok you are right
# May 26th 2017, 15:23 hmic easiest way: just don't do an associative array, but put them like: 'Bids.listing_id = OtherBids.listing_id', ...
# May 26th 2017, 15:23 styks1987 hmic: or is it because I had them in the wrong order? It appears that I am supposed to put the joining table first in conditions?
# May 26th 2017, 15:22 hmic you need to tell the orm that this is no data but identifiers
# May 26th 2017, 15:22 hmic so they get casted to the fitting datatype, thats int. so your strings will all be 0 in the query
# May 26th 2017, 15:22 hmic because you did not tell the orm that these are no values
# May 26th 2017, 15:21 hmic yeah
# May 26th 2017, 15:20 styks1987 http://paste.debian.net/943301/
# May 26th 2017, 15:20 styks1987 looks like something is up with the join. It is filling the conditions with 0
# May 26th 2017, 15:14 styks1987 hmic: I’m copying it from the ->sql() output, might try bin log next
# May 26th 2017, 15:11 hmic that does not make much sense if the generated sql is what you have shwon :-/
# May 26th 2017, 15:11 styks1987 in the orm
# May 26th 2017, 15:11 styks1987 not with the ORM but in regular sequel. I get 3 results for both > and <
# May 26th 2017, 15:10 hmic but only one result?
# May 26th 2017, 15:09 styks1987 that gives me the lowest value
# May 26th 2017, 15:09 hmic you need > OtherBids.amount i guess?
# May 26th 2017, 15:08 styks1987 eventually I need to find listings where matching this information but this test is just a proof that the join works as expected
# May 26th 2017, 15:07 styks1987 hmic: http://paste.debian.net/943260/
# May 26th 2017, 15:06 hmic what does the generated sql look like?
# May 26th 2017, 15:06 hmic the trick is only required if you want the highest bid from multiple users. if you only need the highest bid from one given user, thats way more straight forward
# May 26th 2017, 15:06 styks1987 aren’t they essentially the same thing? Join is just clearer to me for this test