« first day (1274 days earlier)      last day (1384 days later) » 

5:53 AM
Hello everyone !
Anybody in the room?
 
 
10 hours later…
3:32 PM
hi
anyone in the room
?
I have my below query

- WHERE ((STR_TO_DATE(out.o_s_d,'%Y-%m-%d') > CURDATE()) AND
(DATE_FORMAT(STR_TO_DATE(out.o_s_d,'%Y-%m-%d'),'%c/%e/%Y') = (SELECT
DATE_FORMAT((STR_TO_DATE(o.o_s_d,'%Y-%m-%d')),'%c/%e/%Y') FROM out o
WHERE ((out.at = 'y') AND (o.a_id = out.a_id) AND
(STR_TO_DATE(o.o_s_d,'%Y-%m-%d') > CURDATE()) ) GROUP BY o.a_id)))

Now the issue is that I have two data with the same a_id = 100 in my table. for the first row the o_s_d is 2014-09-03 and the second row the o_s_d is 2014-09-11. So when for both the rows the column at='y' then I am getting the row where the o_s_d = 2014-09
 
 
3 hours later…
6:52 PM
@user3454116 that query has problems
it will never be able to use any indexes
@vishuminhas yup!
 
m59
7:05 PM
@TehShrike hello
 
7:40 PM
@m59 howdy
 
m59
I'm surprised this room isn't blowing up.
Considering the difficulty of MySQL, I would imagine more people would flock here than the JS/PHP rooms.
 
m59
8:21 PM
I was just thinking, is there any reason to keep an id field on all tables? I've been doing that just in case it helped, but I think there could be a problem.
In the case where a table stores a unique set of 2 foreign fields, like voting (userId, postId)
if a user keeps toggling their vote, they keep incrementing the id
It seems like if they automated that, it could be an attack that would max out the id
and then people can't vote anymore
 
 
2 hours later…
10:32 PM
@m59 that doesn't sound very viable
You could always add a boolean column to that table
But it's probably not worth worrying about
@m59 and yeah, there is a reason - it makes insertion less expensive, since it can just add the rows to the end of the table instead of having to insert them somewhere in the middle
 
m59
11:01 PM
which isn't viable? them doing the attack (sounds way easy) or keeping the id field?
Is it worth the performance cost?
 

« first day (1274 days earlier)      last day (1384 days later) »