| |
| |
| |
|
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
Comments:
<0> but is it possible that each time a new entry is entered to have it increment the ID column of it by one so it is unique? <1> sure <0> how? <1> you will most likely have to run 2 queries. <0> i was afraid of that <1> or one, if you're clever <1> col1 = col1 + 1 <1> tada. <0> i can do it on a column level? <1> yes. <0> cool <0> and it will take the largest value in the column then? <1> it will take what you feed it <1> that's up to you to figure out how to get the right value. <1> a subquery is required. <0> so lets say i have a col with 3 rows, 1, 2, and 3 so i don't want it to add to 1 or 2 but 3 and next time it should add 1 to 4
<0> whats the best query to do that? <0> i know this might be a bad query but i'm learning. can i have it evaluate against itself <1> sure <0> select * from table where col > col <0> or is that completely illegal? <1> from table_name tbl1 inne rjoin table_name tbl2 on tbl1.index = tbl2.index <1> then use the aliases to control the values. <0> i only have one table though <2> draven, on mysql 5 you could do a trigger, i guess <1> draven: that was using only one table too <0> !trigger <1> !m draven aliases <3> draven: (Database, Table, Index, Column, and Alias Names) : http://dev.mysql.com/doc/mysql/en/Legal_names.html <0> !m draven trigger <3> draven: (CREATE TRIGGER Syntax) : http://dev.mysql.com/doc/mysql/en/CREATE_TRIGGER.html <0> thanks for the info <4> mysql]# mysqladmin -u dba_user -p create drupal <4> Enter p***word: <4> mysqladmin: connect to server at 'localhost' failed <4> error: 'Access denied for user: 'dba_user@localhost' (Using p***word: YES)' <4> # <4> why is that? <4> im following the manual of this drupal <1> you're using the wrong p***word <4> wrong p***word of my root p***word? <1> wrong p***word for dba_user <1> make sure the dba_user exists <4> does this mean dba_user is alrady created <1> and that you are using the proper p***word <1> is it? <1> you should know <4> my first time to use mysql though <4> ok ill create a new one <1> then dba_user is most likely an EXAMPLE <0> so this is the info i get from status: mysql Ver 11.18 Distrib 3.23.56, can i ***ume i'm on version 3.blah.blah? <1> try root <4> ok <1> man mysql, see what -u does <4> wow <4> i dont have mysqld_safe <1> wow what <1> you do <1> find / -name mysqld_safe <4> # mysqld <4> mysqld mysqld-max mysqld_multi mysqldump mysqldumpslow <4> # <1> find / -name mysqld_safe <4> finding.. <1> qwertz: let me guess.... debian? <4> nowhere to be found <4> :(( <4> redhat 8.0 <1> ugh <1> even worse <1> i have no idea how to start it then <4> heheeheh /usr/bin/safe_mysqld <1> bleh <1> red hat stupidity strikes again. <4> hehehe fraggeln <4> frank <1> what
<5> i thought the joke normally starts with Knock Knock <1> zircu: haha <6> hi =) <1> hi <0> is there any reason that i shouldn't user auto_increment since you know that does what i need it to? <6> I want to work with the COUNT(*) value from a query like: SELECT COUNT(*), somevalue FROM table1 GROUP BY somevalue; ... like COUNT(*)/MAX(COUNT(*))*100 ... is there a way to do it or do I have to use multiple queries ? <1> you can do what you said <0> me or him? <1> however, never do count(*). instead , do something like count(PK) <1> feindbild. <7> Why not do COUNT(*)? <1> possible performance penalty <7> Why? <5> if you specify a Primary key or single unique id, mysql knows exactly what you want, no guessing <6> frank-: no =/ MAX(COUNT(*)) results in 'SQL State: HY000] Invalid use of group function' <1> if your table has a lof of columns, then maybe it'll make a difference <4> im in mysql> now <1> but I find the count(PK) cleaner <4> how do i change p***word of my dru_user username? <4> im using mysql -u root -p <5> feindbild: what is your like statment exaclyt? <4> and now im in mysql > <6> zircu: SELECT COUNT(*), MAX(COUNT(*)), lang FROM as_lang GROUP BY lang <6> frank-: COUNT(*) is twice as fast as COUNT(lang) here .. <1> I find that hard to believe. <5> feindbild: is lang a Primary Key or Unique Key? <1> is lang indexed? <5> yeah, is it even indexed? <6> frank-: lang is indexed ... <1> is it a varchar? <6> zircu: neither, just indexed .. <6> frank-: yes <8> Would you guys be able to point me to the appropriate resources that explain how to move data from one table to another? <1> dont count on a varchar column <5> feindbild: you are saying mysql is complaining about that statement? <6> frank-: ... uhm ... sorry .. no ... its a char .. <1> my point still stands <6> zircu: i do ... <1> count an int column, or indexed <6> frank-: <1> however, never do count(*). instead , do something like count(PK) <1> your PK is a char? <1> ew <5> jbrimble: create table dbname.tablename ( /* definition */ ) insert into dbname.tablename (dbname.tablename.fields) select tablename.fields from tablename <6> frank-: no, my pk doesnt appear in the query ... my pk is a int .. <1> I guess you missed my point. <8> cheers, zircu. <5> feindbild: use the pk field as the field you use instead of * inside count() <9> on MyISAM count(*) is instantaneous <1> it might do an internal optimisation, Goplat <1> like only count the PK <1> I'm not sure. <9> myisam just keeps track of the current number of rows so it returns that <1> I guess. <1> the original point was based on the fact that select (*) is slower than select (PK) <5> that sort of makes sense, since PK is a 1 to 1 to how many rows are involved <4> Fatal error: Call to undefined function: mysql_real_escape_string() in /home/httpd/norminet/agencies/neda-x/includes/database.mysql.inc on line 239 <4> what does that mean? <4> im using 4.2.2 php <4> is that function supported? <1> incompatible versions <5> qwertz: you probably are using mysql client for 3.x <5> qwertz: as i noted your upgrade to a more current according to your package system will be a little work, mysql should probably be updated as well <5> hmm.. trying to edit a multiline string can lead to confusing statements, i hope you got what i was trying to say <10> hi <10> when should I use innodb over mysam ? <11> when you need transactions, mainly. Or when you need some other feature that's not supported by myisam tables (yet): http://dev.mysql.com/doc/refman/5.1/en/roadmap.html <10> what about speed and reliability ? <11> innodb is significantly slower, but the only reason myisam is so fast is because it's not a real database. Only the simplest of apps don't really need transactions, which means a crashed (or killed) apache process will leave the database in an inconsistent state. But apps have to be written to use transactions with innodb, you don't get that magically. <10> vandemar: thanks <12> How do I restrict the number of preforked mysql processes? <12> I looked all through the server system variables but didn't see anything. <12> I want to prefork 2 or 3 processes, not 8! Memory is a bit scarce on this machine. <13> mysql does not prefork processes <13> if you're counting memory down to the KB it might be time for an upgrade
Return to
#mysql or Go to some related
logs:
sudo lecture_file #oe #perl #gentoo gtk change-theme ubuntu ati x1600 second display problem #debian #asm gentoo permissions portage group #lgp
|
|