@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16



Comments:

<0> with mysql is there away to work out the average from a list of numbers?
<1> AVG()
<0> thanks :D
<2> my question was a bit stupid.. I'll try to make it better
<2> I've a table with two fields, A and B
<2> I want the sum of 'B' where 'A' is distinct value
<2> so if i've (A,B) = (1,2) (1,3) (2,1), the sum should be 3
<2> (1,3) should not be summed because '1' is not unique and was already seen
<3> in the case of indistinct rows, what determines which row should be included in the sum?
<2> bobfield, does not matter
<2> as log as just one is used
<2> the first, the last... everything is valid
<2> s/log/long/
<3> not a deterministic result
<2> I agree, but it's a non deterministic problem :)
<2> filtering multiple votes from the same IP in a web service



<3> sounds like you need a subquery
<2> mysql < 4.<subqueryadded>
<2> ;(
<2> and if I can't have a subquery...
<2> I've to while()
<4> Anyone know much about .net and MySQL?
<3> antirez, how about a temporary table?
<5> antirez: GROUP BY
<2> if I use GROUP BY, then I can't SUM()
<5> antirez: really.. that's news.
<6> antirez: yes you can
<2> arjenAU, well I mean: I'm not able to SUM if I do group by
<2> the sum is then relative to the group
<2> and not inter-row
<6> of course
<5> antirez: which kinda intended.
<2> ok the problem is that with GROUP BY I'm able to take every IP a single time
<5> antirez anyway, I think you're approaching this problem from completely the wrong angle.
<2> the query problem or the IP abuse one? :)
<5> antirez: you're ***uming that your dataset looks like the above, and are now struggling to query it.
<5> antirez: it might be wise to reconsider your design, so that you can query it. design for output, not input.
<2> wise suggestion
<5> in short, it's not a query problem, it's a design problem.
<2> but I've a problem...
<2> I can't finter in the 'insert' stage
<5> I have my moments.
<2> hehehe
<5> finter??
<2> filter :)
<2> because later the user need the illusion that the vote is what I considered to be
<5> ok so you have a table into which you insert... then process it sometime into somewhere else.
<5> it's not rocket science. jeez.
<5> huh
<2> it must be kinda real time, btw now I think I've the solution with GROUP BY
<5> so?
<7> can someone explain this to me? http://pastebin.com/586069
<2> the vote can be only -1 or +1
<3> maybe a unique key so the duplicate vote is never recorded?
<2> so if i select and GROUP BY IP the first time +1 votes, the second -1 votes, the row count is just the info I need
<5> I'm just saying your table design should be appropriate. that may mean inserting differently. I don't see what that has to do with any real time requirements. it's fine.
<2> no really need to sum, the number of rows is enough
<2> yes I see your point, good idea...
<2> I'll try to rethink it
<2> and possibly change the DB layout
<8> I'm in the process or re-setting up my replication. But I can't seem to CHANGE MASTER TO.... or LOAD DATA FROM MASTER...
<8> I've rsync -rvpogt the data from the one server to the other. When I do the change master command I get Failed to open the relay log './dell1-relay-bin.000001'
<7> anyone know why this is happening? http://pastebin.com/586070
<9> DaJoob: Maybe you should do : "RELOAD PRIVILEGES;" ?
<7> i just did "flush privileges;" - no luck
<7> and doesnt it do that automatically when you use a grant statement?
<7> i have no idea why this isn't working
<10> Because you're not doing it right.
<7> well, obviously
<10> You said you didn't know.
<7> but if i only knew what specifically it was that im not doing right
<10> Something we'd all like to know...
<7> anybody have any other ideas?
<3> select * from mysql.user where user='thatguy';
<3> see what's actually there
<11> DaJoob: try to grant to thatguy@localhost
<10> What is the GRANT statement? Let's see if there is something obviously wrong with it...



<7> GRANT ALL ON example.* TO thatguy IDENTIFIED BY 'hisp***';
<10> !m DaJoob adding new user
<12> DaJoob: (Adding New User Accounts to MySQL) : http://dev.mysql.com/doc/mysql/en/Adding_users.html
<8> with replication how do I do "replicate all database but.."
<10> You can't.
<3> !man replication startup options
<12> (Replication Startup Options) : http://dev.mysql.com/doc/mysql/en/Replication_Options.html
<3> --replicate-ignore-db=dbname
<3> --replicate-ignore-table=tablename
<10> Cool
<8> bobfield, thanks!!
<3> kpettit, anytime
<13> is there some way in sql to renumber a sequence?
<13> these aren't keys, which are unique and auto_increment, these are user part numbers
<13> and they don't want holes nor duplicates. yet, their users create them all the time.
<13> so i need to go through, and for each one, if the previous one is not this one - 1, then make this one previous + 1.
<5> !tell us about renumbering
<3> muhoo, set a variable, then increment it as you update
<12> arjenAU asked me to tell you this: About resetting AUTO_INCREMENT and renumbering rows: http://www.livejournal.com/users/arjen_lentz/36015.html
<13> no no no
<13> this isn't auto-increment
<13> the user can make it whatever they want.
<5> you may wish to ponder the fundamentals anyway
<5> the above question is bollocks
<3> set @num=0; update table set field=(@num:=@num+1);
<13> ah, that looks useful, thanks
<5> partnumbers are only useful if they never change. or is this is a game of how to confuse the customer?
<13> they haven't yet pushed these live
<13> no customer has seen them. but monkeys are pounding away at them, getting them in "just the right" order
<14> does anyone know of a query that can be used to get a timestamp of when a table was last written to?
<13> before the event
<13> once they're "just right", then they'll add them to the parts list which is public
<5> muhoo: but... who cares? noone is going to put these numbers in a list to see if there are "holes". and in a few months one part will go out... ooh dear, another gap.
<5> muhoo: how much time are you gonna waste on this?
<5> there is no order to part numbers.
<13> arjenAU: dude, it matters. these are auction numbers. they have to be sequential and without holes. trust me.
<13> arjenAU: enough until it works :-)
<5> part# != auction#. you just changed the question
<5> !tell us about sequence
<12> But I don't know a thing about that.
<5> !tell us about sequences
<12> arjenAU asked me to tell you this: In MySQL you can approximate flexible sequences - see http://www.livejournal.com/users/arjen_lentz/34627.html
<13> triggers sound like a smart way to do it. in the meantime, i have to triage, but thanks, this is good stuff
<5> muhoo: re the non-gaps. there will always be gaps. if a # is ***igned to an item but retracted before auction, you have a gap. you can't renumber the stuff then as the catalog will have been put out there.
<13> heh, i love these questions like "why does the user want to do that?" because, they do.
<3> the customer is the boss
<5> muhoo: no, the question is relevant. "because" is not a reason" and the customer is not the design expert.
<13> they want this to behave like a spreadsheet, exacty as said in the comments on that blog entry
<5> the customer may be subject matter expert, but they're not the design expert. what they say they want is not always exactly what they mean.
<5> it's upto you to figure out what it is they really need.
<5> blindly following them is a very bad idea.
<5> if they want a spreadsheet, they should use one.
<13> which is relationally linked to the whole rest of the app?
<5> anyway what you can do is ***ign some pk when you enter items.
<13> i don't think that's possible
<13> there is already a unique, auto_increment pk, which the user cannot see and cannot **** up on me
<5> them at some point "when you print the catalogue" you could do a query that inserts a separate field with a magic auction# for each item in that auction.
<5> it would do that only once and at the point in time the #s will have no gaps.
<5> problem solved.
<13> this maintains the relational integrity and keeps me sane
<13> arjenAU: then how do they sort them?
<5> you should probably distinguish between internal and external IDs.
<14> muhoo: just manage your list of available auction numbers outside of mysql
<13> no, they have hundreds of items. the auction number is how they sort them.
<13> the order is important
<5> muhoo: you run a query to sort it any way you want, and then ***ign the #s to the result set. the result set is processed back into the db. you can do this in a single query
<14> muhoo: yeah, just manage the _list_ of them outside of mysql
<14> muhoo: then insert them into mysql as required
<3> set @magicnum=0; select *, (magicnum:=magicnum+1) as AuctionNum from table;
<3> voila new numbers every time
<13> bobfield: that looks useful, IF i can maintain the order of the existing numbers as i tromp on them with magicnum:=
<15> is there anything else other than including the path to libmySQL.dll, and uncommenting the extension=php_mysql.dll that needs to be done for me to not get an "undefined function call" to mysql_connect()??????


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #mysql
or
Go to some related logs:

moneyplex missing fonts
mysql tutorials Functions dev
#math
/dev/input udev ps2
grub hd0 fatal error dapper
kubunty java
#osdev
ip.blacklist.zap
#lisp
#gaim



Home  |  disclaimer  |  contact  |  submit quotes