| |
| |
| |
|
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14
Comments:
<MetaMorfoziS> it isnt solveable withoun subquery? <MetaMorfoziS> with simple LEFT OUTER JOIN? <Xgc> MetaMorfoziS: Did you read the entire article? <gleam_> select name,count(msg) as count from mytable group by name order by count desc limit 10? <jpeg> so you're logging an IRC channel to a mysql database? <MetaMorfoziS> yes <MetaMorfoziS> gleam_: ^^ it seems good for me , moment i tryit <Tuxthepenguin> I need help with an import problem <MetaMorfoziS> gleam_: nice! thank you, very very <Tuxthepenguin> I'm typing: "mysqlimport supertux backup.sql" but im getting this error: "Error: Table 'supertux.backup' doesn't exist, when using table: backup" <gleam_> mysqlimport isn't for sql files <gleam_> use mysql supertux < backup.sql <Tuxthepenguin> oooh <Tuxthepenguin> I feel so stupid now <Tuxthepenguin> XD <Tuxthepenguin> ty for that :p :) <Tuxthepenguin> having to move my fansite to another server and causing me lots of problems :p <Tuxthepenguin> well only 1 problem left now <Tuxthepenguin> :) <MetaMorfoziS> can i count words in a string? <MetaMorfoziS> or count a string in a string? for me thats enough if i count's the spaces and +1:) <Tuxthepenguin> well you "CAN" count them manually <Tuxthepenguin> :p <MetaMorfoziS> in string-function-s i'm not found any function that can do this <MetaMorfoziS> oh! Tuxthepenguin thank you!:) <roo9> does anyone know if it's possible to do something similar to seconds_behind_master in mysql 4.0? <Tuxthepenguin> nothing beats manually counting <Tuxthepenguin> :p <gleam_> no, your best bet is to see how many bytes behind it is in the binary log roo <lampo> what the right datatype to use for boolean <lampo> *what is <MetaMorfoziS> boolean:D <Tuxthepenguin> boolean <Tuxthepenguin> ? <Tuxthepenguin> :/ <lampo> there is boolean in mysql? <MetaMorfoziS> :\ <MetaMorfoziS> yes <Tuxthepenguin> XD <gleam_> it's just tinyint <lampo> in sql server i believe theres bit for that <lampo> ok <gleam_> well <gleam_> 5.0 there's bit <MetaMorfoziS> oh not <gleam_> before 5.0 bit is tinyint <MetaMorfoziS> DOUBLE <MetaMorfoziS> not? <gleam_> boolean is still tinyint <MetaMorfoziS> ok <MetaMorfoziS> so can i count words in a string? <MetaMorfoziS> or can i count a string in a string? <gleam_> doubt it <gleam_> do it in your app <MetaMorfoziS> it's heavy <MetaMorfoziS> beacuse its in top 10 <gleam_> heh i can think of a dirty way to do it <gleam_> interested? <MetaMorfoziS> zes <MetaMorfoziS> yes <MetaMorfoziS> :) <gleam_> select length(col)-length(replace(col,' ','')) <MetaMorfoziS> http://dev.mysql.com/doc/refman/5.0/en/string-functions.html <MetaMorfoziS> i checked that <MetaMorfoziS> hoh <MetaMorfoziS> hm <MetaMorfoziS> this returns the length of the string <MetaMorfoziS> without spaces <MetaMorfoziS> not? <gleam_> whole thing <gleam_> first returns length of the string <gleam_> second returns length minus spaces <gleam_> difference = # of spaces <MetaMorfoziS> hm <MetaMorfoziS> lol! <MetaMorfoziS> :DDDDD <jpeg> um... forgive the blasphemous idea, but should mysql really be used for text manipulation? <gleam_> i agree entirely <gleam_> it's possible this will be faster than doing it in his app <gleam_> i'd still rather do it in an app <MetaMorfoziS> gleam_: it's cool:D you are on the edge:D <Kaitlyn> when doing a search against a database, how can I return a portion of the results? LIke all modern serach engines show the sentence of the relevant search for the page... how can I do that? <fluxdude_home> i've accidentally blown my mysql.db table away, could somebody point me in the direction to recreate it, while I can see the fields I don't know what types they should be or what default values they should have (I ***ume 'N') <gleam_> this test server and test data takes 200msec to return the results of that (the length/lengthreplace thing) for 4000 rows <gleam_> so my guess is it might be faster to do it in an app <gleam_> 4000 rows with about 1k of text in each row <gleam_> spaces: 638168 <gleam_> length: 3807601 <gleam_> across all rows <gleam_> heh <andrewbryson> or with v4 :P <roo9> fluxdude_home: your going to need to do a new mysql_create_system_tables <roo9> fluxdude_home: your basically going to have to re-create the whole mysql database <gleam_> isn't it mysql_install_db? :) <gleam_> or do both exist? <Kaitlyn> anyone answer for me? :) <roo9> gleam_: i actually looked, i have mysql_create_system_tables <gleam_> weird <gleam_> i have both <andrewbryson> Kaitlyn: well you really need to learn sql for that - have a look at the syntax of the select query <gleam_> oh i see <andrewbryson> i always thought it was mysql_install_db too <roo9> gleam_: and, i do not have mysql_install_db <gleam_> mysql_create_system_tables spits out sql <Kaitlyn> its match against().. i found out how to get a score rating for it... but thats as far as I could get <gleam_> and mysql_install_db actually puts the stuff into the datadir <roo9> and, this is a package from mysql <Zakabog> How would I do a select where (contact_id = $var AND member_id = $var2) OR (contact_id = $var2 AND member_id = $var) <gleam_> basically mysql_install_db runs mysql_create_system_tables and puts them in the db <gleam_> roo <andrewbryson> Kaitlyn: the usual technique is to put the table structure and the select that you have now into a pastebin and then post the link here and ask questions about it <gleam_> check in, uh <gleam_> scripts/ <gleam_> mysql-5.1.9-beta-linux-i686-glibc23/scripts/mysql_install_db <andrewbryson> well ok... most people leave out the table structure bit :P - but it is a whole lot easier to figure out what is going on with that included :P <Zakabog> Would I have to do two selects? <roo9> gleam_: ah, in scripts <roo9> i was looking in bin <gleam_> just do exactly what you said zakabog <gleam_> did ou even try it? <fluxdude_home> roo9: that ****s, I don't wanna recreate the whole mysql thingy, I just wanna recreate the db table; <gleam_> mysql_create_system_tables should spit out schema <gleam_> just use that <Zakabog> Well no because I didn't think that'd work I just came up with what I think it would be but I have no idea how to do a select statement <roo9> fluxdude_home: listen to gleam, he is smarter than me <gleam_> just try it <Zakabog> Hehe k <gleam_> fluxdude: mysql_create_system_tables test | grep "^ CREATE TABLE db" <roo9> that probably won't work so well since the create table statemnt is on multiple lines? <gleam_> it's just one line <gleam_> 1577 characters <gleam_> at least on mine. <roo9> yeah <andrewbryson> even if it was on multiple lines why would that be an issue ? <roo9> 2 seconds after I typed that I was like, i'm probably wrong... <gleam_> because the grep would only grab the first line <andrewbryson> all of my create table statements are on multiple lines <roo9> andrewbryson: from what source? <andrewbryson> sql does not care about end of line characters - it just treats them as white space <gleam_> andrew is talking about something else <andrewbryson> ah :P <gleam_> roo's concern was that the grep would only match the very first line of the create table statement <andrewbryson> oh right <gleam_> but since the create table statement is only on one line <gleam_> it doesn't matter <roo9> need to use PCRE :) <fluxdude_home> thanks for the help gleam_ and roo9, I've found mysql_install_db and read the script, I know how to rebuild this table manually without touching the rest of the database... <roo9> np :) <Zakabog> gleam_ mysql isn't giving me any errors with the query but I'm getting no results <Zakabog> SELECT * FROM `contact_list` WHERE ('Contact_ID' = 5 AND 'Member_ID' = 32) OR ('Contact_ID' = 32 AND 'Member_ID' = 5); <gleam_> '' denotes a string
Return to
#mysql or Go to some related
logs:
MPLayer emerge wrong skin gentoo daylight savings #debian #lisp #php Couldn't run Build.PL: Argument list too long eth0 does not exist 8139 gentoo kerb5 deb #debian libdl.so.2 fedora fc5 LD_ASSUME_KERNEL
|
|