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 3/21.

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

02:39 <****> crackintosh: You didn't show the create table statement of flavtrak.tblmasterfood. I suspect you'll find a difference.
02:40 <****> jbalint?
02:40 <****> Xgc: should I remove lines 6 through 158?
02:41 <****> crackintosh: No idea. Another approach is CREATE TABLE menumine.tblmasterfood LIKE flavtrak.tblmasterfood;
02:41 <****> Xgc: so that basically says copy the structure of the other table?
02:42 <****> crackintosh: By using that form, the column count and order will match your assumption, even though making the assumption is usually a bad idea.
02:42 <****> arjenAU can you help me make that wuery work? I didn't understood what left join does.. i tryed the mysql manual but it says in dependencies.. more complicated then you explained
02:42 <****> crackintosh: Well, I don't know yuor goal here. But the new table doesn't currently match the old.
02:43 <****> but i say to drop the table in the beginning of the script
02:43 <****> and create a new table
02:43 <****> crackintosh: The new table you'r creating doesn't match the old.
02:43 <****> however, is mysql saying that the table I am creating is not matching the one I am trying to copy from.
02:43 <****> alright.
02:44 <****> A column name of `1` is probably not suggested.
02:44 <****> I am basically trying to copy a table from one database to a table in another database. However, if the table exists, i would like it to be dropped.
02:45 <****> crackintosh: Then use the form I showed: DROP TABLE IF EXISTS newname; CREATE TABLE newname LIKE oldname;
02:45 <****> crackintosh: Yuo can use dbname.newname as needed.
02:48 <****> Xgc: Under this system, I would not need to change the script if I change the fields in my tables, correct?
02:49 <****> crackintosh: That's not guaranteed.
02:49 <****> Xgc: any ideas why this isn't working?
02:49 <****> crackintosh: You're still making assumptions about field order that might not be true.
02:50 <****> sqlnoob: I haven't see your last attempt.
02:50 <****> s/see/seen
02:50 <****> (SELECT MONTH(listing_date),count(*) AS month_count
02:50 <****> FROM Listing GROUP BY MONTH(listing_date) ORDER BY month_count LIMIT 1 DESC)
02:50 <****> UNION
02:50 <****> (SELECT MONTH(listing_date),count(*) AS month_count
02:50 <****> FROM Listing GROUP BY MONTH(listing_date) LIMIT 1);
02:50 <****> sqlnoob: Use a pastebin.
02:51 <****> http://rafb.net/p/5DYAgQ84.html
02:52 <****> sqlnoob: What behavior don't you like?
02:52 <****> sqlnoob: One of your sets doesn't have well defined order.
02:53 <****> Xgc: I thought ASC was default so need to order
02:53 <****> sqlnoob: ASM is the default *if you have an ORDER BY clause*.
02:53 <****> s/ASM/ASC
02:54 <****> sqlnoob: A table has no implicit order.
02:55 <****> ah ok I got it working, thanks
02:55 <****> You're welcome.
02:55 <****> is there any fast way to return the name of the month isntead of the number?
02:56 <****> sqlnoob: No date/time function for that?
02:56 <****> !man date and time function
02:56 <****> (Date and Time Functions) : http://dev.mysql.com/doc/mysql/en/date-and-time-functions.html
02:57 <****> thanks
02:59 <****> Xgc: you mention before if several months have the same amount, how would you take care of that?
03:00 <****> sqlnoob: Use/provide a secondary ordering, like month_name or month_number.
03:01 <****> Xgc: no no, i mean in terms of returning them too if they have same count
03:02 <****> sqlnoob: Oh. The second approach would return all the max and min matches.
03:02 <****> argh!! lol i shoulda done that from the begining then!!
03:03 <****> i shoulda read more carefully sorry
03:04 <****> Xgc: so how does it work? I get the whole result (all months with their counts) and then I intersect or something similar with the count of min and max?
03:05 <****> Xgc: does this look better? http://pastebin.com/d75023ca
03:05 <****> sqlnoob: Did you see the form I showed?
03:05 <****> crackintosh: You'
03:06 <****> crackintosh: You're missing the INSERT ... SELECT... ; to populate the new table.
03:06 <****> Oh, I thought you said I could erase that, thanks.
03:06 <****> crackintosh: Otherwise, it's fine.
03:09 <****> I dont' get very well the last join you mention... i have this: http://rafb.net/p/YByy7N41.html
03:10 <****> from there im not sure join what with v1, imalready using original query
03:11 <****> sqlnoob: Does that return the max and min counts?
03:11 <****> yes
03:11 <****> in a sepparate column
03:13 <****> If I changed this statement ALTER TABLE `database`.`tblname` DROP INDEX `indexname` to ALTER TABLE `database`.`tblname` DROP INDEX *
03:13 <****> sqlnoob: Ok. Now JOIN that the original derived table once again... ON v2.month_cnt IN (v1.max_cnt, v1.min_cnt)
03:13 <****> would it delete all indexes on that tbl?
03:13 <****> does * means all index?
03:16 <****> kimseong: that is what im suggesting
03:16 <****> kimseong: I dont know if it will work.
03:16 <****> sqlnoob: SELECT v1.* FROM (SELECT MAX(month_count) AS max_cnt, MIN(month_count) AS min_cnt ... rest of last pastebin entry) AS pb JOIN (same as other derived table) AS v1 ON v1.month_count IN (pb.max_cnt, pb.min_cnt);
03:16 <****> Im trying to clean up this sql script I have so it isnt 15 pages long.
03:16 <****> sqlnoob: Something like that.
03:17 <****> Why are MySQL 6 and 5.2 developed at the same time?
03:18 <****> One is being developed and one is being maintained
03:20 <****> Max_-: If I told you and sensei to develop different features and your feature was due to be release in 10.5 and sensei's to be released in 11.1, would sensei necessarily have to wait for your 10.5 release before beginning work?
03:20 <****> Xgc : okay.. that's for the falcon engine...
03:21 <****> Xgc: what you mean by "same as other derived table"?
03:21 <****> Max_-: or could sensei work in parallel and every so often merge in the 10.5 changes as a sanity check?
03:21 <****> sqlnoob: (your derived table called v1) AS v1
03:21 <****> INSERT INTO adminuser (username, password) VALUES ('admin', 'mypassword');
03:22 <****> anyone see something wrong with my syntax?
03:22 <****> My "real" question is... I'm starting over in a few days, coding a brand new webapp with mysql, now I know foreign keys are a good tool, and they're only available from 5.2... So should I read the 5.2 and install it or stick with 5.0 or 5.1 and build my databases w/o the new feature?
03:22 <****> sqlnoob: Just look at your last paste.
03:23 <****> so basically the same query twice insite the big query?
03:23 <****> (since 5.2 is not judged stable release yet)
03:23 <****> Max_-: That depends on your requirements.
03:24 <****> Max_-: The decision isn't necessarily obvious.
03:24 <****> Xgc : okay.. well.. that's because I'm starting from scratch, making my requirements very flexible, that it's even less obvious to choose :P
03:26 <****> Max_-: You may wish to start development with 5.1 and upgrade to 8.12 sometime prior to final release.
03:27 <****> or upgrade several times during development.
03:27 <****> 8.12?!
03:28 <****> or start with 6.0 and work through al the expected pains as you go, expecting that 6.0 will be ready with your final deployment.
03:28 <****> probably wont
03:28 <****> Max_-: 8.12 was just an example.
03:28 <****> Xgc: http://rafb.net/p/fSxFIt48.html
03:28 <****> that's what I thought... thanks
03:29 <****> okay, I'll just go with the latest 5.*
03:29 <****> sqlnoob: Pretest the sunqueries.
03:29 <****> sqlnoob: subqueries.
03:30 <****> pretest?
03:30 <****> sqlnoob: Each derived table should stand on it's own.
03:32 <****> If I want to select table.* from table, but get distinct values on a column, how would I do it?


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

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


Tutti i nuovi CAP Italiani. Come ottenere il database completo