Home Page   #c  #ruby-lang  #cisco  #mysql  #apache  #javascript  #java  #perl  #php  #openmoko   Wallpapers Girl
Reliable $1 Web Hosting by 3iX

Channels


#mysql

05 November 2007


Total 21 pages. You are browsing page 4/21.

First :: Prev :: [...] [2] [3] [4] [5] [6] [...] :: Next :: Last

03:32 <****> Is there another option besides distinct ?
03:32 <****> smtlaissezfaire: SELECT DISTINCT(field) FROM table;
03:33 <****> smtlaissezfaire: GROUP BY
03:33 <****> but won't that only return the field ?
03:33 <****> smtlaissezfaire: Correct.
03:33 <****> Not all of the fields?
03:33 <****> smtlaissezfaire: You can't properly return them all without proper aggregation.
03:33 <****> distinct is not a function
03:33 <****> ebergen: We know.
03:33 <****> Who said it was?
03:34 <****> smtlaissezfaire: Continue.
03:34 <****> I learned that the other night, from the good people in #mysql
03:34 <****> smtlaissezfaire: SELECT DISTINCT(field) FROM table;
03:34 <****> ebergen: That's correct.
03:34 <****> SELECT DISTINCT field FROM table is better
03:34 <****> ebergen: That's also correct.
03:34 <****> ebergen: Now let us continue.
03:34 <****> not for me or your but for the people that think distinct is a function and get confused by distinct(field1), field2
03:34 <****> s/your/you/
03:34 <****> I'm putting these values into an OR-mapper, though, so I don't want surprises about what fields I'm getting back. I want *ALL* of the fields back.
03:34 <****> ebergen: It's not really important what you think as this point.
03:35 <****> ebergen: It's perfectly fine (standard).
03:35 <****> I just get tired of explaining that distinct isn't a function
03:35 <****> ebergen: Then stop interrupting.
03:35 <****> using examples that don't show it as a function will help
03:35 <****> ebergen: No one said is was.
03:35 <****> calm down
03:35 <****> s/is/it
03:36 <****> Xgc: ok i separate this but then it doesnt make sense anymore so im putting it all together, im not sure how this works
03:36 <****> ebergen: Read the standard. You seem to be the only one that didn't understand that correct usage.
03:36 <****> I know it's correct usage
03:36 <****> I know that distinct isn't a function
03:36 <****> _other people don't_
03:36 <****> Xgc: Can you point the way to a good tutorial on GROUP BY? I've never used it before.
03:36 <****> smtlaissezfaire: Hmmm... Not sure. Try a tutorial or maybe MySQL has one.
03:37 <****> I looked at the mysql manual, but I can't find exactly the information I'm looking for there.
03:37 <****> smtlaissezfaire: The idea is that you would GROUP BY the tuple you want to be distinct for each row and then select proper aggregates for the other fields.
03:38 <****> what is a tuple?
03:38 <****> smtlaissezfaire: For instance: SELECT field1, field2, MIN(field3), MIN(field4) FROM tbl GROUP BY field1, field2;
03:38 <****> smtlaissezfaire: A pair os a tuple of two values/fields.
03:38 <****> s/os/is
03:40 <****> Can I not use GROUP BY with only one field?
03:40 <****> can I grant all and option in the same user
03:40 <****> ?
03:40 <****> group by works on an expression
03:40 <****> smtlaissezfaire: Sure. I was showing a more interesting case as an example.
03:40 <****> like this GRANT ALL, OPTION ON *.* TO
03:40 <****> can i do that?
03:41 <****> hi guys
03:41 <****> hello
03:41 <****> is there a way i can do a mysqldump of the last hour?
03:41 <****> so a time senstible dump
03:41 <****> can i grant all and option at the same time
03:41 <****> ?¡
03:41 <****> hey, anyone want to chat about business or need looking for a simple small job pm me please
03:41 <****> JZA: You can supply a WHERE clause to select time sensitive rows/data.
03:41 <****> go to codh
03:42 <****> Xgc: from mysqldump? how can I specify a SQL statement on mysqldump?
03:42 <****> JZA: But that might not be convenient for multiple tables.
03:42 <****> Xgc: right
03:42 <****> Can I grant all and option at the same user?
03:42 <****> JZA: So the more practical answer is, not easily.
03:43 <****> Xgc: how can I specify a SQL statement to mysqldump?
03:43 <****> what kind of statement?
03:43 <****> JZA: -w or --where=
03:43 <****> mysqldump allows you to specify a where
03:45 <****> ebergen: oh ok I see, can I make something like this mysqldump -p database -c "SELECT * FROM table where ID = 10 to 300"
03:45 <****> assuming -c is for the SQL command
03:45 <****> not really
03:45 <****> but you can specify the database and table as part of the mysqldump command line and do --where="id = 10"
03:46 <****> ebergen: can I specify a range?
03:46 <****> you can specify any valid where statement
03:46 <****> Xgc: hey how about this: http://rafb.net/p/qmwf4h64.html same problem.. i sepparated it.
03:46 <****> ebergen: ok thanks
03:46 <****> Can I do some like GRANT ALL, OPTION ON ...........?
03:47 <****> fitoria try it
03:47 <****> OK
03:48 <****> ebergen: no I cant
03:48 <****> throws error
03:48 <****> sqlnoob: Yuo have an ON clause that has no related JOIN.
03:48 <****> Xgc, I don't think I understand how group by would limit the results
03:49 <****> sqlnoob: That was in the previous paste.
03:49 <****> smtlaissezfaire: GROUP BY causes the result set to contain one row per unique set of values in the GROUP BY clause.
03:49 <****> my mysql 5.0.44 diend with a signal 6 (compiled with debug) what does the 6 stand for?
03:50 <****> fitoria grant all on foo.bar to 'blah'@'blah' identified by 'blah' with grant option should work
03:50 <****> thanks
03:50 <****> Xgc: ok, so tell me what I'm doing wrong here:
03:50 <****> I have two users in the users table with first name "scott"
03:50 <****> s/diend/died/
03:50 <****> and I'm issuing this query:
03:50 <****> select count(*) from users where users.first_name = "scott" group by first_name;
03:50 <****> Why does this return 2, and not 1 ?
03:51 <****> Am I being really dense?
03:51 <****> smtlaissezfaire: Because that group (for scott) has two rows).
03:51 <****> 2 person with the same name
03:52 <****> the problem is reproducable
03:52 <****> smtlaissezfaire: You'll get it. The GROUP BY says to produce one result for each value of last_name. Since the scott group has two rows, the count(*) for that scott group is 2.
03:52 <****> smtlaissezfaire: Sorry. I meant first_name.
03:55 <****> I'm not sure what the point of this is, though. I understand that two groups of one user a piece are being sent back. But why would I want this?
03:56 <****> sqlnoob: Btw, what did you mean by "same problem"? Which of those statements are a problem? Show the exact errors.


Total 21 pages. You are browsing page 4/21.

First :: Prev :: [...] [2] [3] [4] [5] [6] [...] :: Next :: Last


Tutti i nuovi CAP Italiani. Come ottenere il database completo