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

Channels


#mysql

09 October 2007


Total 22 pages. You are browsing page 3/22.

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

02:03 <****> CREATE TABLE ( id serial, v char(1) UNIQUE);
02:03 <****> get it?
02:03 <****> Right.
02:03 <****> now, if I do INSERT IGNORE
02:04 <****> and v already exists, does it set LAST_INSERT_ID()?
02:04 <****> to the row that contains v
02:06 <****> Simetrical: unfirtunately I get "uid" is ambiguous in from clause
02:06 <****> shamrock, well, that's easy to fix. Change USING (uid) to ON categories.uid=r2.uid.
02:07 <****> ON?
02:07 <****> Yes, like in the other join in the query.
02:07 <****> ON is a keyworfd?
02:08 <****> Yes.
02:08 <****> Hmm. Empty result set with SELECT questions.question,
02:08 <****> questions.answer, questions.cid, categories.name FROM categories
02:08 <****> JOIN questions ON categories.uid=questions.cid
02:08 <****> JOIN (SELECT CEIL(RAND() * (SELECT MAX(questions.uid) FROM questions)) AS uid ) AS r2 ON categories.uid=r2.uid ORDER BY categories.name LIMIT 1;
02:08 <****> It's equivalent to putting the same condition in the WHERE clause.
02:08 <****> ok.
02:09 <****> Simetrical: any ideas?
02:09 <****> Then I mucked up the query somewhere. I dunno, I'm too tired to focus on this, and I don't properly understand what you did with the joining to a single row anyway.
02:09 <****> fuse_lt, no, sorry, other than the obvious (e.g., SELECT MAX(id) FROM table).
02:09 <****> category.uid
02:10 <****> hm
02:10 <****> if i do INSERT IGNORE INTO tbl (v) VALUES ('test') ON DUPLICATE KEY UPDATE id=id;
02:10 <****> that should surely set last_insert_id
02:12 <****> how can I make a change to character_set_database permanent?
02:13 <****> INSERT INTO test (v) VALUES ('apple') ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);
02:13 <****> that seems to do it
02:14 <****> erm
02:14 <****> why not REPLACE?
02:14 <****> me?
02:14 <****> yes
02:14 <****> can it insert a new record?
02:15 <****> REPLACE works exactly like INSERT, except that if an old row in the table has the same value as a new row for a PRIMARY KEY or a UNIQUE index, the old row is deleted before the new row is inserted.
02:15 <****> i definitely don't want to do that
02:15 <****> or i wrongly understand what you need?
02:15 <****> ah, ok
02:16 <****> i just want to add a new record, if it already exists, i want the primary key of that row
02:17 <****> SELECT id FROM table WHERE unique_key='myvalue';
02:17 <****> will set global affect all databases or just the currently selected one?
02:17 <****> Simetrical: probably more efficient would be SELECT COUNT(*) FROM table WHERE unique_key='myvalue';
02:17 <****> I wish to change the character set for a database
02:18 <****> thoughtful, he wants the actual id's, though, not just whether any exist.
02:18 <****> having difficulties with it, if someone has some pointers, that would be wonderful
02:18 <****> Actual id, that is.
02:18 <****> good point. sold to the man in t-shirt over there.
02:18 <****> *in the
02:19 <****> Marticus ALTER DATABASE
02:19 <****> thank you
02:19 <****> erm... wasn't it obvious?
02:21 <****> to someone who is familiar enough with mysql I'm sure
02:21 <****> but to someone fumbling their way in the dark...
02:21 <****> I really have no business doing what I am doing, but the customer needs phpmyadmin to show their data in chinese as it was saved, not as garbled latin characters
02:22 <****> I would have thought using AddDefaultCharset directive and DefaultCharset phpmyadmin config option would have done it
02:22 <****> but no...
02:23 <****> okay, I'm done ranting
02:23 <****> here is the deal, the database is latin1
02:23 <****> you can always hire someone who has a clue
02:23 <****> the data saved to it is ... gb2312 I guess
02:23 <****> i guess chinese encodings f*ckup is worst than ever russian
02:24 <****> Athfar if only that were an option, CPA's don't need an excuse to not spend money
02:24 <****> utf-8 is coming too late
02:24 <****> I agree, this site/database is so old, it predates utf8
02:24 <****> isn't that a double negative
02:25 <****> redundant maybe...
02:25 <****> so let me ask this, will changing the database charset screw up anything?
02:26 <****> or is that a bad idea?
02:26 <****> it is currently latin1
02:26 <****> perhaps probablu
02:26 <****> *probably
02:26 <****> on which part?
02:26 <****> or both :)
02:26 <****> it can completely mess text data
02:27 <****> rabble!
02:27 <****> I changed a table to a different charset and it got screwed, so I was leary
02:27 <****> although one would think a bunch of ???? is a bonus
02:28 <****>:)
02:28 <****> were
02:28 <****> make backups at least
02:28 <****> indeed
02:29 <****> (and binary is better in that case, if you can stop server)
02:34 <****> suppose I change the database defaults and then reimport the data
02:41 <****> hey guys, select key1,key2,key3,number,data1,data2 group by key1,key2,key3 having max(number) << how can I alter that so it gets me the data for the one with the largest number in each group of keys?
02:55 <****> what length do i give a column type of datetime?
02:56 <****> scott0: I dont' think you need to specify a length
02:56 <****> so default is 0
03:04 <****> i have a field in a table thats either 0 or 1, i dont care to know which it is i just want to change it, is this any way possible in an update statement?
03:05 <****> update table set field = if(col=0,1,0);
03:05 <****> ...where ....
03:05 <****> use !
03:05 <****> field = !field
03:05 <****> yea that's cooler
03:06 <****> hehe
03:06 <****> whats up chadmaynard
03:06 * chadmaynard is at the beach
03:06 <****> in GA?
03:06 <****> at night?
03:06 <****> nah in alabama.
03:06 <****> you son of a beach!
03:06 <****> I've been here since last thursday


Total 22 pages. You are browsing page 3/22.

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


Tutti i nuovi CAP Italiani. Come ottenere il database completo