@# 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 17 18 19



Comments:

<0> is it possible to embed a query within an insert statement?
<1> CrazyTux: The bottom line is there is no way (that I know of) via standard or non-standard SQL to add an alias to all columns of a table, unless you generate the SQL string dynamically.
<1> herede: Yes.
<0> Xgc: how?
<1> herede: INSERT INTO tablename ... SELECT ...;
<1> herede: The docs cover that form.
<0> Xgc: thanks
<2> Xgc what exactly is the purpose and an alias.
<2> ?
<3> Xgc, http://pastebin.com/594879 whats wrong with that?
<1> Shaba1: Usually, it's to descriminate between conflicting columns. But it's generally used in an [derived column].
<1> s/an/any
<4> crazytux:you can use SELECT a.*, b.* FROM table_A a left join table_B b ....
<5> whats teh difference between attribute checks and ***ertions
<3> soulfreshner, isn't what I have the same thing?
<4> crazytux - didn't you have an 'AS' in your query?



<2> Anyone here yous phpmyadmin or eskuel?
<3> soulfreshner, yea?
<2> I am confused at to weather or not it acutally saves the FK relations when it saves a table.
<2> I have read tutorials that says you can make FK relations
<4> crasytux - doesn't it work if you remove the 'as'?
<3> soulfreshner, nope.
<2> then again I have read some that say you can make them and display them but it will not save them to the table
<6> I have a table that has 4 number values in it. I needed to sum up them PER row, not as a total, so I was doing SELECT rate1+rate2+rate3+rate4 AS price and this was working. Then I realized that I need to average them... That is, if one of the rate values is 0, I need to divide by 3 instead of 4... How can I do this per row?
<1> CrazyTux: a.id isn't a valid alias without quoting it. Use something more like a_id.
<3> Xgc, ah :)
<1> Time to run. Later all.
<3> Xgc, thanks :)
<7> what would stop a SELECT DISTINCT c.* FROM table c WHERE .... from working correctly (getting duplicate results) when I put it in to a UNION DISTINCT ?
<4> thanks Xgc!
<5> is there a difference between attribute checks and ***ertions/
<5> anyone
<4> Davey: why would you use DISTINCT in both the select and the UNION?
<7> soulfreshner: because I don't always UNION these queries, in truth ;)
<6> is it avg() ? can I p*** multiple variables to avg?
<4> hmmm...I can't think of a reason it wouldn't work unless you discovered some bug where two distincts cancell each other :-?
<7> soulfreshner: but removing it from the UNION DISTINCT doesn't help
<4> davey - may be a stupid question, but does your table have an id field?
<7> soulfreshner: yes
<7> if by that you mean Primary Key
<5> what does this do
<4> davey: and every id is distinct?
<7> its a Primary Key, of course.
<6> am I making any sense?
<5> reach(x) <- source(x), reach(x) <- reach(y) and arc(y,x), notreach(x) <- target(x) and not reach(x)
<5> for a datalog program
<4> davey: that means every row with an ID will be returned...
<7> uhm, what?!
<4> davey: which means every row, even if all the other data is the same
<7> right, but I'm getting *duplicates*
<4> duplicate id's as well!?
<7> as in LIMIT 10,20 == same as LIMIT 20,30\
<7> they wouldn't be duplicates otherwise :P
<4> sorry - I misunderstood the problem then :(
<4> is your query in the pastebin?
<6> is there a mysql avg_row type command? I'm looking for a row average of 4 numbers, not a column average
<7> no, and I can't put it there without breaching NDA :/
<4> oops
<8> how can I select a subset of a SELECT query, for instance only row 11-20?
<4> what about a sample query just to demonstrate the problem...
<7> _spudse: LIMIT 11,9
<7> well, you probably want 10,10, I ***ume you're paging 10 rows at a time, right?
<7> so it'll be 0,10 = page 1, 10,10 = page 2, 20,10 = page 3 etc
<8> Davey, yeah exacly. Thanks.
<8> mysql really has some nice functions
<7> want my job? :P
<5> anyone here know datalog
<6> sigh
<5> how it works
<4> davey: what happens when you remove the distinct from the select statement, but keep it in the union?
<7> soulfreshner: I can't do that
<4> if it has a primary key, it should be distinct anyway, shouldn't it?
<7> only if you select by the primary key
<4> so distinct does nothing in that context
<4> but you select * ?
<4> that includes the primary key?
<7> what if a non unique column contains the same data, and its using that column in the WHERE?



<7> argh, I'm being an idiot, thanks soulfreshner, I think you might be right. :/
<7> the same row is never selected twice, even if it matches more than one WHERE criteria for an OR. Brain fart :/
<4> hehe - it happens to us all ;)
<7> I've been futzing with this same piece of ****ty for a damn month. I hate my boss. :/
<9> well aes_encrypt is flawed
<10> sup all
<10> is there something wrong with this query?
<10> $query = "SELECT * FROM detail WHERE project LIKE '%$search%' OR status LIKE '%$search%' OR attn LIKE '%$search%' OR desc LIKE '%$search%' OR salute LIKE '%$search%' ORDER BY project";
<10> can you only use 3 LIKEs or what?
<9> thats just ugly
<7> Thanks soulfreshner, sorry for being an *** :)
<4> samuel: what error do you get? the query looks fine unless there is something in $search that shouldn't be there
<4> davey: no prob
<10> nope, $search is a word from a POST in a webpage
<10> soulfreshner: i cant figure it out, it does the syntax error message
<7> samuel: $search contains something it shouldn't
<4> echo $query?
<7> ***uming PHP, do $search = mysql_escape_string($_POST['search'])
<4> it is most likely an apostophe (') in $search
<4> but it could be anything - echo $query to see what mysql sees
<9> i have found a bug in mysql
<9> only took all day
<9> sigh
<9> i feel special
<9> where is my damn cookie
<10> soulfreshner: no ', just a word: i get the error when i do the select in mysql:
<10> #1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'desc LIKE '%CELANESE%' OR salute LIKE '%CELANESE%' ORDER BY pro
<4> desc is a reserved word
<4> use backticks
<4> `desc`
<10> really? a reserved word? dammit... nobody told me this...
<10> thanks!
<4> try to allways use backticks anyway - it makes for horrible weeks of bughunting
<4> desc table; shows all the fields in a table...
<11> hi all
<11> can anyone helpme to export a database with mysqldump from mysql-4.0.18 to mysql-4.0.24
<10> soulfreshner: thanks for the tip... ill remember that in the future.
<11> mysqldump database > file.sql
<11> then in the new server: mysql database < file.sql
<11> but i got an error from syntax of file
<12> what's the error?
<4> samuel: np
<4> Burnys: did you try mysqldump -opt database > file.sql ?
<6> How can I average 4 numbers in a mysql query - not as a total at the bottom, but per row???
<4> or is it --opt?
<4> i forget
<11> soulfreshner yeah
<11> ERROR 1064 at line 142: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'option varchar(50) NOT NULL default '',
<11> ordering int(11) NOT
<11> its version mismatch syntax
<11> infi : above
<4> weird - try backticking option...might be a new reserved word :/
<11> this is the line
<11> CREATE TABLE mos_components (
<11> id int(11) NOT NULL auto_increment,
<11> soulfreshner sorry...my english its not so good...what can i do ?
<12> not really. option is probably a reserved word. use -Q
<4> in the file.sql file, put backticks around the word `option`
<11> `` or
<11> infi -Q ?
<11> where?
<12> Burnyz: soulfreshner's suggestion is faster. `
<11> ok
<4> burnys - a backtic is the funny quote next to the 1 key on your keyboard (not the normal single quote)
<12> if you still get it on the various INSERT statements later, re-dump it using the -Q option of mysqldump in addition to whatever else you are using.
<11> ok
<11> ah ok
<11> mysqldump -Q database > file.sql
<11> ok ?
<6> I guess I can not perform an average on a mysql row?
<4> -opt includes -Q afaik
<13> roler: You can do whatever you want to your data.
<12> soulfreshner: nope
<11> great


Name:

Comments:

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






Return to #mysql
or
Go to some related logs:

grub freq 60
#mysql
#perl
ubunto osprey 210
projectM fedora
#kde
dodmraid dmraid
mediawiki Call to undefined function: session_name()
#gentoo
recomnd linux



Home  |  disclaimer  |  contact  |  submit quotes