Re: multiple primary keys on one table?
I have a primary key set on a table which consists of the combination of the values: firstname, lastname, and a schedule_id (BIGINT(20))... I have this so the records in this table do not have duplicates, being that no one record should have the exact same name and schedule_id identifier. However, I want to keep this same restriction while also ensuring that no two records have the same email_address and schedule_id identifier... You can't have the db enforce two different primary keys on one table, so how would I implement having this kind of restriction, which, in itself, seems to require that I have a second primary key to enforce another constraint to dissalow records to be added that carry the same combination of: email_address and schedule_id? You cannot have multiple PRIMARY key constraints, that's why it's called primary. You can, however, use multiple unique constraints, which do (almost) the same. With regard to other replies: indices are used for quick data retrieval, constraints for business requirements. That there happens to be something as a unique index is an implementation artifact. Martijn Tonies Database Workbench - development tool for MySQL, and more! Upscene Productions http://www.upscene.com My thoughts: http://blog.upscene.com/martijn/ Database development questions? Check the forum! http://www.databasedevelopmentforum.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: multiple primary keys on one table?
You will have to UPDATE to NULL those fields, modify the aplication to enter NULL instead of empty-string... Then add the UNIQUE INDEX... In MySQL (unless modified) the dafault is that NULL values are incomparable thus allowing the creation of a UNIQUE INDEX. -- -- -- -- -- -- -- -- -- -- -- -- -- -- Gabriel PREDA Senior Web Developer -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: multiple primary keys on one table?
right... - Original Message - From: Gabriel PREDA [EMAIL PROTECTED] To: Ferindo Middleton [EMAIL PROTECTED] Cc: Dan Buettner [EMAIL PROTECTED]; mysql@lists.mysql.com Sent: Friday, October 06, 2006 6:31 PM Subject: Re: multiple primary keys on one table? You will have to UPDATE to NULL those fields, modify the aplication to enter NULL instead of empty-string... Then add the UNIQUE INDEX... In MySQL (unless modified) the dafault is that NULL values are incomparable thus allowing the creation of a UNIQUE INDEX. -- -- -- -- -- -- -- -- -- -- -- -- -- -- Gabriel PREDA Senior Web Developer -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Memory Use
Dear MySql, Using: 5.1.11 on AIX (precompiled 64-bit) with 100% InnoDB, 4GB memory. Our MySql is consistently using 150% memory, or 50% paging space. Once it gets to 150%, it tends to stay at this limit consistently. I am trying to find a tool to tell me what it is using, and some documentation about how to control MySQL memory use. Would some kind member help me find these? Regards, Ben Clewett. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Replication
--replicate-wild-do-table=db_name.tbl_name replicates only updates that use the specified table in the given database. If any wild cald patterns specified, then match the specified database and table name patterns. Tells the slave thread to restrict replication to statements where any of the updated tables match the specified database and table name patterns. I tried this, and it's not replicating. --replicate-wild-ignore-table=db_name.tbl_name Tells the slave thread not to replicate a statement where any table matches the given wildcard pattern. So to replicate only the merge_t table, try a) set-variable= binlog-do-db=DatabaseB set-variable= replicate-wild-do-table=DatabaseB.merge_t Except that you can't replicate a MRG table. to replicate all the tables except merge_t b) set-variable = binlog-do-db=DatabaseB set-variable = replicate-wild-do-table=DatabaseB.% set-variable = replicate-wild-ignore-table=DatabaseB.merge_t Ref: http://www.mysqlpress.com/doc/refman/5.0/en/replication-options.html Yes, this works, but as I said in my message, I don't want to replicate all the tables, just one. This DOESN'T work: set-variable= binlog-do-db=DatabaseB set-variable= replicate-do-table=DatabaseB.bar_t Though it should. I suspect that it's because of the MRG table, but I don't know what's wrong or how to fix it. (I should note this is Mysql 4.1.22) -- WANT TO MODEL FOR MAC BUMBLE? APPLY AT http://casting.macandbumble.com - Eric Anderson Mac and Bumble Bumble Cash ICQ 3849549 http://www.macandbumble.com http://www.bumblecash.com San Diego, CA[EMAIL PROTECTED] [EMAIL PROTECTED] - SEE OUR LATEST PARTY PICTURES -- http://events.macandbumble.com/ -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: How can I extract 3 IDs from only 2 columns/rows?
I'm a newbie, for sure, but can't you use OR to accomplish this? SELECT * FROM release_hack WHERE BID IN (5749, 7355, 6454) OR oBID IN (5749, 7355, 6454); Could it be as simple as I am? Regards, Jerry Schwartz Global Information Incorporated 195 Farmington Ave. Farmington, CT 06032 860.674.8796 / FAX: 860.674.8341 -Original Message- From: Daevid Vincent [mailto:[EMAIL PROTECTED] Sent: Thursday, October 05, 2006 8:06 PM To: mysql@lists.mysql.com Subject: How can I extract 3 IDs from only 2 columns/rows? I have written a bug tracking system (http://sourceforge.net/projects/roachphp which is pretty out of date currently). It has a feature to regress a CR (change request, previously known as a bug). That is, if you fix a CR in maint, you can duplicate it to trunk so that you can test it there too. I also have this table that tracks these copies. Now I want to start showing the 'tree' and also optionally be able to weed out regressed CRs from listings. But I'm stuck. Given a table like this, how can I get a list of all THREE CRs / BIDs. select * from release_hack where BID in (5749, 7355, 6454); +---+--+--+-+ | ReleaseID | BID | oBID | TS | +---+--+--+-+ |72 | 6454 | 5749 | 2006-05-18 11:05:52 | |67 | 7355 | 5749 | 2006-07-25 16:29:26 | +---+--+--+-+ I have a 'bug' table with a BID of course which the above is a reference too. The problem is that people don't always copy from the original CR. Someone might fix something in say 4.5 (trunk) and then clone the CR to 4.2 (maint), then use THAT cloned one to clone again to another version (higher or lower). This example they happen to be the same original one. But in theory the logic would work the same. This could very easily look like this too: +---+--+--+-+ | ReleaseID | BID | oBID | TS | +---+--+--+-+ |72 | 6454 | 5749 | 2006-05-18 11:05:52 | |67 | 7355 | 6454 | 2006-07-25 16:29:26 | +---+--+--+-+ So what I want to get is a query or set of queries (I'm using PHP and mySQL 5.0.22 but not INNODB) that given any one of the three BIDs (5749, 7355, 6454) I can get the other two back, reguardless of which column it starts in. ÐÆ5ÏÐ -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: speed up index creation on existing tables?
Sounds like a very nice idea to me, but this could be a problem if temp tables need to be bigger than RAM+Swap, which could easily be the case in a table with 100,000,000 rows. Gabriel PREDA schrieb: For this table this is to late... leave it running... If you want to do this on another table(s)... and in general on huge loaded MySQL servers I recomend the following... Create a directory let's say /mnt/mem_fs Mount in it /dev/shm use tmpfs as filesystem... Now you have a directory that stores all the info in memory... if the available alocated memory in consumed then it will start swaping... but compute all values so that it dosen't... In my.cnf set a MySQL directive like: tmpdir = /mnt/mem_fs This way MySQL will create temporary tables in memory rather than creating them on disk !!! I'm pretty sure you can figure out the speed improvment ! -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Memory Use
Ben, the my.cnf file (usually in /etc/my.cnf) usually contains the settings related to memory usage. You can see info on a lot of the various settings here: http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html and here for InndoDB-specific: http://dev.mysql.com/doc/refman/5.0/en/innodb-parameters.html If you post the output of SHOW VARIABLES we can take a look and tell you what you might have misconfigured. Dan On 10/6/06, Ben Clewett [EMAIL PROTECTED] wrote: Dear MySql, Using: 5.1.11 on AIX (precompiled 64-bit) with 100% InnoDB, 4GB memory. Our MySql is consistently using 150% memory, or 50% paging space. Once it gets to 150%, it tends to stay at this limit consistently. I am trying to find a tool to tell me what it is using, and some documentation about how to control MySQL memory use. Would some kind member help me find these? Regards, Ben Clewett. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Two Tables Comparator
Rich, it looks to me like your SQL should work - I've never used '!IN', always used 'NOT IN' instead, but that's not to say it won't work. I do note that you're missing the join criteria for your tables classes, signups ... Am I misunderstanding your question? Dan On 10/5/06, Rich [EMAIL PROTECTED] wrote: Hi folks. Any suggestions on the following? If a student signs up for classes, I don't want them viewing those classes so they can choose them again. So I want to take out their 'signups' from the master class list. select classnumber, classnumbersignup from classes, signups where classnumber !IN (select classnumbersignup from signups where userid = [$myID]) and mytype = 'yellow'; I don't want to have to rely on middleware for this. Cheers -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Bug or No bug - Composite Unique Key using null values
List, I have been mulling over this for a few days reading docs and going back and forth with people on this, so I figured I would come here before writing up a bug report. First of all, I have tested this on 4.1.18, 5.0.16, and 5.0.22 within Solaris 9 and Mandrake Linux LE 2005 environments. For the sake of ease, I will just set up a small test table to assist me with this question. Create table test ( x smallint not null, y char(5) default null, z char(10) not null default '', Unique Key `s`(x, y) ) ENGINE=MyISAM test Insert into test values (1, 'dan', 'yes'), (2, 'joe', 'no'), (3, NULL, 'maybe'); test Select * from test; +---+--+---+ | x | y| z | +---+--+---+ | 1 | dan | yes | | 2 | joe | no| | 3 | NULL | maybe | +---+--+---+ Now, here is the kicker. When I try to run an Insert Into test Values (3, NULL, 'yes'). It inserts it without matching the duplicate key which clearly is in the table, or is it. As the docs state, NULL can never equal NULL, so this is the correct behavior. Which leads me to my question... test Insert into test Values (3, NULL, 'yes'); Query OK, 1 row affected (0.00 sec) test Select * from test; +---+--+---+ | x | y| z | +---+--+---+ | 1 | dan | yes | | 2 | joe | no| | 3 | NULL | maybe | | 3 | NULL | yes | +---+--+---+ Should the duplicate key checker be using the null-safe equals operator when checking for duplicate unique keys? Since primary keys cannot have nulls in them, then they are fine. This only happens when a unique key with a null value is encountered. Thanks, in advance, for any and all input. -- -Dan -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Bug or No bug - Composite Unique Key using null values
Dan, this is documented behavior: http://dev.mysql.com/doc/refman/5.0/en/create-index.html Specifically, A UNIQUE index creates a constraint such that all values in the index must be distinct. An error occurs if you try to add a new row with a key value that matches an existing row. This constraint does not apply to NULL values except for the BDB storage engine. For other engines, a UNIQUE index allows multiple NULL values for columns that can contain NULL. Dan On 10/6/06, Dan Julson [EMAIL PROTECTED] wrote: List, I have been mulling over this for a few days reading docs and going back and forth with people on this, so I figured I would come here before writing up a bug report. First of all, I have tested this on 4.1.18, 5.0.16, and 5.0.22 within Solaris 9 and Mandrake Linux LE 2005 environments. For the sake of ease, I will just set up a small test table to assist me with this question. Create table test ( x smallint not null, y char(5) default null, z char(10) not null default '', Unique Key `s`(x, y) ) ENGINE=MyISAM test Insert into test values (1, 'dan', 'yes'), (2, 'joe', 'no'), (3, NULL, 'maybe'); test Select * from test; +---+--+---+ | x | y| z | +---+--+---+ | 1 | dan | yes | | 2 | joe | no| | 3 | NULL | maybe | +---+--+---+ Now, here is the kicker. When I try to run an Insert Into test Values (3, NULL, 'yes'). It inserts it without matching the duplicate key which clearly is in the table, or is it. As the docs state, NULL can never equal NULL, so this is the correct behavior. Which leads me to my question... test Insert into test Values (3, NULL, 'yes'); Query OK, 1 row affected (0.00 sec) test Select * from test; +---+--+---+ | x | y| z | +---+--+---+ | 1 | dan | yes | | 2 | joe | no| | 3 | NULL | maybe | | 3 | NULL | yes | +---+--+---+ Should the duplicate key checker be using the null-safe equals operator when checking for duplicate unique keys? Since primary keys cannot have nulls in them, then they are fine. This only happens when a unique key with a null value is encountered. Thanks, in advance, for any and all input. -- -Dan -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Bug or No bug - Composite Unique Key using null values
I have been mulling over this for a few days reading docs and going back and forth with people on this, so I figured I would come here before writing up a bug report. First of all, I have tested this on 4.1.18, 5.0.16, and 5.0.22 within Solaris 9 and Mandrake Linux LE 2005 environments. For the sake of ease, I will just set up a small test table to assist me with this question. Create table test ( x smallint not null, y char(5) default null, z char(10) not null default '', Unique Key `s`(x, y) ) ENGINE=MyISAM test Select * from test; +---+--+---+ | x | y| z | +---+--+---+ | 1 | dan | yes | | 2 | joe | no| | 3 | NULL | maybe | | 3 | NULL | yes | +---+--+---+ Should the duplicate key checker be using the null-safe equals operator when checking for duplicate unique keys? Since primary keys cannot have nulls in them, then they are fine. This only happens when a unique key with a null value is encountered. The behaviour you're seeing is correct according to the SQL Standard. Given that NULL does not equal NULL, the tuples(x,y) for (3,NULL) are different and thus valid. Martijn Tonies Database Workbench - development tool for MySQL, and more! Upscene Productions http://www.upscene.com My thoughts: http://blog.upscene.com/martijn/ Database development questions? Check the forum! http://www.databasedevelopmentforum.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: startup in OS-X
On 10/6/06, Chris Elhardt [EMAIL PROTECTED] wrote: apologize for the newbie question. installed mySQL 4 some time ago, and just played around with it in terminal. Now that I really need to learn some database, I can't get it to start in terminal. it autostarts; I can see it in the activity monitor as a background process. but when I try to invoke it from Term I get a 'cmd not found' message. trying to figure out what I'm doing wrong: chris. Chris, try: whereis mysql and then try to execute mysql with the whole path that you got from the command -- http://www.obed.org.mx --- blog -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: startup in OS-X
Usually mysql is located at /usr/local/mysql in the terminal window. Using Terminal, get to /usr/local/mysql/bin 'ls' will give you the list of files in the folder Try ./mysqld_safe On 10/6/06, Chris Elhardt [EMAIL PROTECTED] wrote: apologize for the newbie question. installed mySQL 4 some time ago, and just played around with it in terminal. Now that I really need to learn some database, I can't get it to start in terminal. it autostarts; I can see it in the activity monitor as a background process. but when I try to invoke it from Term I get a 'cmd not found' message. trying to figure out what I'm doing wrong: chris. Rahul S. Johari Supervisor, Internet Administration Informed Marketing Services Inc. 500 Federal Street, Suite 201 Troy NY 12180 Tel: (518) 687-6700 x154 Fax: (518) 687-6799 Email: [EMAIL PROTECTED] http://www.informed-sources.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
MySQL 5 query takes 100x longer than MySQL 4.1.10
I have a simple query in MySQL 5.0.24: insert into table1 (col1) select distinct col1 from bigtable; that will run for 1:14:18. Both tables are MyISAM and table1 was just created with 2 columns and is empty. The select distinct col1 from bigtable takes only 2 minutes to run if I run it by itself (without the Insert statement), so why does inserting it into Table1 take over an hour? This worked fine under MySQL 4.1.10 BigTable has 30 million rows in it and will return approx 7000 distinct values. TIA Mike -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: How can I extract 3 IDs from only 2 columns/rows?
Thanks for reply, but no, that isn't want I need. That query assumes I know all three IDs. I only know ONE ID (the CR I'm looking at currently), and I want to find the other two... DÆVID -Original Message- From: Jerry Schwartz [mailto:[EMAIL PROTECTED] Sent: Friday, October 06, 2006 6:13 AM To: 'Daevid Vincent'; mysql@lists.mysql.com Subject: RE: How can I extract 3 IDs from only 2 columns/rows? I'm a newbie, for sure, but can't you use OR to accomplish this? SELECT * FROM release_hack WHERE BID IN (5749, 7355, 6454) OR oBID IN (5749, 7355, 6454); Could it be as simple as I am? Regards, Jerry Schwartz Global Information Incorporated 195 Farmington Ave. Farmington, CT 06032 860.674.8796 / FAX: 860.674.8341 -Original Message- From: Daevid Vincent [mailto:[EMAIL PROTECTED] Sent: Thursday, October 05, 2006 8:06 PM To: mysql@lists.mysql.com Subject: How can I extract 3 IDs from only 2 columns/rows? I have written a bug tracking system (http://sourceforge.net/projects/roachphp which is pretty out of date currently). It has a feature to regress a CR (change request, previously known as a bug). That is, if you fix a CR in maint, you can duplicate it to trunk so that you can test it there too. I also have this table that tracks these copies. Now I want to start showing the 'tree' and also optionally be able to weed out regressed CRs from listings. But I'm stuck. Given a table like this, how can I get a list of all THREE CRs / BIDs. select * from release_hack where BID in (5749, 7355, 6454); +---+--+--+-+ | ReleaseID | BID | oBID | TS | +---+--+--+-+ |72 | 6454 | 5749 | 2006-05-18 11:05:52 | |67 | 7355 | 5749 | 2006-07-25 16:29:26 | +---+--+--+-+ I have a 'bug' table with a BID of course which the above is a reference too. The problem is that people don't always copy from the original CR. Someone might fix something in say 4.5 (trunk) and then clone the CR to 4.2 (maint), then use THAT cloned one to clone again to another version (higher or lower). This example they happen to be the same original one. But in theory the logic would work the same. This could very easily look like this too: +---+--+--+-+ | ReleaseID | BID | oBID | TS | +---+--+--+-+ |72 | 6454 | 5749 | 2006-05-18 11:05:52 | |67 | 7355 | 6454 | 2006-07-25 16:29:26 | +---+--+--+-+ So what I want to get is a query or set of queries (I'm using PHP and mySQL 5.0.22 but not INNODB) that given any one of the three BIDs (5749, 7355, 6454) I can get the other two back, reguardless of which column it starts in. ÐÆ5ÏÐ -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Free chapter of O'Reilly High Performance MySQL on replication
Thought this might be of interest to some on the list: http://www.oreilly.com/catalog/hpmysql/chapter/ch07.pdf -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: MySQL 5 query takes 100x longer than MySQL 4.1.10
Mike, was this a straight software upgrade on the same box? Any settings changes? Dan On 10/6/06, mos [EMAIL PROTECTED] wrote: I have a simple query in MySQL 5.0.24: insert into table1 (col1) select distinct col1 from bigtable; that will run for 1:14:18. Both tables are MyISAM and table1 was just created with 2 columns and is empty. The select distinct col1 from bigtable takes only 2 minutes to run if I run it by itself (without the Insert statement), so why does inserting it into Table1 take over an hour? This worked fine under MySQL 4.1.10 BigTable has 30 million rows in it and will return approx 7000 distinct values. TIA Mike -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
A tricky Query
Hi, I have a table like : ID date_from date_to price_code price dateadded 1 07:10:2006 31:12:2099 p11007:10:06 2 17:10:2006 31:12:2099 p12007:10:06 3 27:10:2006 31:12:2099 p11007:10:06 4 01:11:2006 31:12:2099 p12007:10:06 5 05:10:2006 31:12:2099 p12008:10:06 6 10:10:2006 31:12:2099 p12008:10:06 7 25:10:2006 31:12:2099 p12008:10:06 Basically there are price codes and the price , i have to find the effective price for the date today. The price must be calculated also on the latest added date. Pl. help me. I shall be very grateful. -- Regards, Abhishek jain
Re: MySQL 5 query takes 100x longer than MySQL 4.1.10
At 09:37 PM 10/6/2006, Dan Buettner wrote: Mike, was this a straight software upgrade on the same box? Any settings changes? Dan Hi Dan, When I installed MySQL 5.0 I used the My.ini for dedicated server and edited it to use my old settings. I also noticed if I had InnoDb turned on, access to MyISAM tables were 4x slower so I deactivated InnoDb and MyISAM speeded up, except for this one query. Also if I just execute just the Select distinct col1 from bigtable it executes right away (probably still in the query cache). If I then execute: insert into table1 (col1) select distinct col1 from bigtable; it still takes 1 hour to complete (it should only take a couple of minutes at most). Table1 is dropped and re-created just prior to executing the Insert statement so it's not corrupted. Col1 is the same column type in both tables Char(17). Any idea what's going on? TIA Mike On 10/6/06, mos [EMAIL PROTECTED] wrote: I have a simple query in MySQL 5.0.24: insert into table1 (col1) select distinct col1 from bigtable; that will run for 1:14:18. Both tables are MyISAM and table1 was just created with 2 columns and is empty. The select distinct col1 from bigtable takes only 2 minutes to run if I run it by itself (without the Insert statement), so why does inserting it into Table1 take over an hour? This worked fine under MySQL 4.1.10 BigTable has 30 million rows in it and will return approx 7000 distinct values. TIA Mike -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: A tricky Query
hi. can you give more details ? how is effective_price for today calculated - for example if u need price for 11th oct 2006, i'm assuming all u need is the price for date_from / date_to when there's a match in the range. yashesh bhatia. On 10/7/06, abhishek jain [EMAIL PROTECTED] wrote: Hi, I have a table like : ID date_from date_to price_code price dateadded 1 07:10:2006 31:12:2099 p11007:10:06 2 17:10:2006 31:12:2099 p12007:10:06 3 27:10:2006 31:12:2099 p11007:10:06 4 01:11:2006 31:12:2099 p12007:10:06 5 05:10:2006 31:12:2099 p12008:10:06 6 10:10:2006 31:12:2099 p12008:10:06 7 25:10:2006 31:12:2099 p12008:10:06 Basically there are price codes and the price , i have to find the effective price for the date today. The price must be calculated also on the latest added date. Pl. help me. I shall be very grateful. -- Regards, Abhishek jain -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]