@# 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



Comments:

<0> the count here is based on the number of rows of each Item_Id .. right?
<1> yeah
<0> My table is Order_Item(Order_Item_Id, Item_Id, Price, Quantity) .. and I want the count to be based on the quantity also .
<0> I'm confused
<1> group by Item_Id, Quantitiy
<1> SELECT Item_Id, Quantity, COUNT(*) cc
<2> whats the command in a query to display the last table that was inserted?
<3> s/inserted/created ?
<2> ahh
<2> i mean the last row of a table that was inserted
<2> sorry
<4> last_insert_id()
<3> well there is no generic solution
<4> but that only gets you the last inserted auto_increment number
<5> add a column with the insert time
<6> If i ALTER TABLE with a few operations, and one of them fails, do others are executed?



<5> rows in the table has NO order at all
<2> ya ;\
<2> so i gotta makea script to sort the order of a field on my table?
<3> zimnyx: in mysql all DDL statements cause an implicit commit
<5> yes, select can helps your order
<6> DyB|Vandal: i mean one ALTER statement.
<5> zimnyx: usually 1 fail will abort all
<7> http://pastebin.com/722427 <- sql query and question
<5> zimnyx: msyql tries to build a new table and rename it later after deleting the old table
<8> yeah .. mysql does a copy of the entire table
<5> so it is possible to abort the alter table
<5> even for myisam table
<9> anyone use triggers? i'm trying to update the same table that's being inserted into from one
<9> it apparently isn't legal (probably since you could cause recursion), but is this 100% not doable?
<6> lokus: I guess some bug occours, i can't drop column from a table (err 150)
<6> the same problem i had with FK..
<5> !perror 150
<10> sql is broked
<10> MySQL error code 150: Foreign key constraint is incorrectly formed
<6> lokus: ALTER TABLE `accountOperations` DROP `saleId`;
<6> ERROR 1025 (HY000): Error on rename of './company/#sql-186d_f7' to './company/accountOperations' (errno: 150)
<5> zimnyx: there is probably another column in another table referencing the col you want to delete
<5> zimnyx: drop that fk first
<4> or set FOREIGN_KEY_CHECK = 0
<4> or some such
<4> then back to 1 after you're done
<11> where's the man for create functon; found the one for create function in C; but i want to create one in sql
<9> you can use the information_schema table to search for any foreign keys that reference your table most likely
<11> s/man/man page/
<6> lokus: no there is no reference to that column. Yeah, dropping the FK would help.. thanks
<5> Narada: check the manual http://dev.mysql.com/doc
<11> k
<6> lokus: i've met some weirg behaviours of mysql5 + FK . guess it's a bug.
<5> Narada: it is called stored function, in the stored routine chapter
<5> zimnyx: then report it with a reproducible test case
<7> Onizuka: someone can please give me an hand?
<11> lokus: aha!
<5> Narada: hope you have version 5
<11> lokus: do you know if a stored function can only return a scalar value like a variable; or can it return a result set too?
<11> lokus: oh yeah; i'm always on bleeding edge baby
<5> Narada: i thought i mentioned earlier i do not know if result can be returned, that why i told you to use subquery
<11> lokus: honestly i don't remember getting any responses from you; i'll check back
<5> Narada: does not make much sense for cuntion to returned result set
<5> *function
<6> lokus: thnaks for help.
<5> Narada: or maybe someone else, someone ask for something similar earlier
<11> lokus: just checked; didn't see anything from you; anyway problem with subquery is that i have a complex select in an sp but you can't have sp's in a subquery; but i don't want to take the select out of the sp and put in another select because then the complex logic would be in two places
<11> hmm seems like a dead end
<12> Hi,
<12> If i use "group as" how do i specify which field shows up, for example "firstname". I would like the Firstname taht is marked as "primary" to show when doing a group.
<13> select firstname, count(firstname) from users group by firstname
<12> but i want it to ONLY display the firstname that is primary
<12> but sum up amount for evryone
<12> is
<13> darkdrgn2k: i'm not sure what you mean
<12> select firstname, sum(amount) from users group by firstname order by primary
<12> or better yet
<12> select firstname, sum(amount) from users group by lastname order by primary
<12> so every one in a family with the same last name is counted, but only the primary name is displayed
<13> select firstname, count(lastname) from users group by lastname order by primary



<12> jink: but i want the sume of amount, not the amount of people
<12> but i want the persons name that has the primary field set to whow up as the "firstname"
<12> *show up* even
<14> what might be considered quite a large table for a mysql database (how many rows)?
<13> select firstname, sum(amount) from users group by lastname order by primary
<13> tkp_: millions?
<14> oh really
<14> ok... so not 100,000 then!
<13> nope
<13> not 100k
<14> cool
<12> jink: it continues to put the wrong name down
<12> let me paste my whole sql
<12> (its a little more complex then my example)
<13> darkdrgn2k: maybe you could pastebin part of your table and what you would expect
<12> http://hashmysql.org/paste/viewentry.php?id=1844
<12> p***word: help
<15> anyone know a website that explains the differences between joins.. and what situations to use the different ones in?
<13> !m Jy join
<12> jy: inner means If there is no data in table 2 then dont include table 1
<12> jy: left means if there is no data in table 2, display it as null but include table 1
<12> !m
<12> !m darkdrgn2k join
<13> !man join
<10> bot is broke
<15> bot didn't send anything
<13> gleam-: no **** :)
<12> lol
<12> dig deeper!
<15> darkdrgn2k, thanks..
<12> jy: those are the only ones i use soo... yeh
<12> jink: any idea?
<13> well, i don't see any table data, so i can't predict what this would do, or how it differs from what you expect
<12> LOL i dont wanan dump 4 tables LOL
<12> but basically..amount paid is a float
<12> planmember is an int
<12> date is a date
<12> primary is a tiny int iether 0 or 1
<12> problem: i have 3 people with the same planmemberid
<12> in table planmember
<12> wendy
<12> joe
<12> and jack
<12> oops sorry thats in planmembers table
<16> darkdrgn2k: your enter key is not punctuation.
<12> infi: sory i will stop
<16> don't stop, but please realize that you can put more than one word per line ...
<12> i have a table "planmembers" with 3 entries, jack joe and wendy. Joe has the `primary` field set to 1 every one else to 0
<12> i have a table planmember with one entry, it is the pk and in planmembers i have the fk. the planmember talbe store the employee number and cl***
<12> i would like it to calculate the sum(amount) but display the planmembers name that the `primary` field is set to
<12> the sql in questions continues to display "wendy" instead of joe
<13> inner join planmembers on plan.... and ... .primary='1' ?
<12> but i wish to sum up also the primary='0's
<12> just not display their names
<13> could you paste a describe for all 4 tables?
<12> hmm i think i might have found the issue :-p
<17> converting a varchar data type (that contains an int in text representation) would actually convert it into the correct int?
<17> I ran a quick test and it seems to do it, but I want to be sure it's sane to do
<18> hey, little question, is mysql using syslog? our doe it use its own logging system?
<10> by default it logs to datadir/hostname.err for errors and whereever you specify for the other stuff
<10> some distros send its error output to syslog instead
<17> Cereal_box: its own log
<18> how can i configure it to use syslog for everything?
<10> for everything you can't, as far as i know
<10> for errors, look at the "logger" program
<18> hmm damn
<18> so i can't do remote logging with mysql?
<19> http://pastebin.com/722485
<20> if you have ... replicate-do-wild-table=replicate.% ... and then run : load data from master .... it will only feetch the replicate.% tables correct? or do you gotta specify the ignore databases too?
<10> i'm sure you can figure out a way to use syslog to read the logs it writes to disk
<19> help me
<10> so demanding.
<19> i want to convert rows -> columns of one row
<4> lookup group_concat


Name:

Comments:

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






Return to #mysql
or
Go to some related logs:

#gimp
#php
#centos
hacking tconl
#linux
ubuntu tr1mp sound
#perl
Either enable PNP in your kernel or trim
#linuxhelp
mysqld: Can't open file: 'sessions.MYI'



Home  |  disclaimer  |  contact  |  submit quotes