Re: Selecting records based on max and value
Hi David, David Ruggles wrote: Supplyorder uid double (auto) (pk) sitedouble datedate Supplyorderhistory uid double (auto) (pk) supplyorderuid double status double Supplyorderlineitems uid double (auto) (pk) supplyorderhistoryuid double other fields ... Each time an existing supply order is modified a new history record is created so we have a paper trail of all the changes made to the order and the specific line items ordered are associated with the history record. I want to select for a given date all sites that have the last history record with a certain status. David Ruggles CCNA MCSE (NT) CNA A+ Network EngineerSafe Data, Inc. (910) 285-7200 [EMAIL PROTECTED] This takes two steps. First we find the last histories: CREATE TEMPORARY TABLE tmpLastChanges SELECT MAX(h.uid) max_id, h.supplyorderuid FROM supplyorderhistory AS h WHERE date = '2007-01-08' GROUP BY h.supplyorderuid; Then use that list to get the actual records you seek: SELECT max_id, site FROM tmpLastChanges tlc INNER JOIN supplyorderhistory h on tlc.max_id = h.uid AND h.status = 2 INNER JOIN supplyorder AS s, WHERE h.supplyorderuid = s.uid; This is just one way to implement a "group-wize maximum" query pattern. Search the list and the rest of the web for this term and you will see many other variations. -- Shawn Green, Support Engineer MySQL Inc., USA, www.mysql.com Office: Blountville, TN Are you MySQL certified? www.mysql.com/certification __ ___ ___ __ / |/ /_ __/ __/ __ \/ / / /|_/ / // /\ \/ /_/ / /__ /_/ /_/\_, /___/\___\_\___/ <___/ www.mysql.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Problems with INSERT
[EMAIL PROTECTED] wrote: > I keep getting the following error: > > 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 's > resources than dual monitor mode to generate the video output. Running > in dual' at line 2 > > when I try to add: > > Note : Single-monitor mode uses more of your computer's resources than > dual monitor mode to generate the video output. Running in dual monitor > mode is recommended because it is more efficient. > > > My PHP code to add Q & A is: > > mysql_query("INSERT INTO faqs > (Question, Answer, Category, Date) VALUES('$question', '$answer', > '$category', CURDATE() ) ") > or die(mysql_error()); > > If I enter the above text directly intophpMyAdmin, all is fine. > > Any help is greatly appreciated. > > Thanks > > Haig Haig, $questionEscaped = mysql_real_escape_string($question); mysql_query("INSERT INTO faqs (Question, Answer, Category, Date) VALUES('*$questionEscaped*', '$answer', '$category', CURDATE() ) ") or die(mysql_error()); You need to escape the single quote in your FAQ. David Thanks guys for all your input. Greatly appreciated!! Escaping the single quotes did the trick. Haig -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
external updates/additions of database entries
Hello, I'm looking for help in merging the contents of two database tables with identical columns between them. A base set of data will be stored in the "permanent" table, and incremental additions and/or changes will be introduced in the "staging" table the ID's of the data in the tables is the only thing which won't be in sync. Initially looking through the documentation, a 'natural join' seemed to be the best way to highlight changes. My ideal result would have been all of the entries from the staging table not in the permanent table, however I'm unclear on how to form a query without explicitly naming each row name and using it with a comparison operation. Any help on this subject would be appreciated! thanks! -lev -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: making graphs with MySQL data
C.R.Vegelin escribió: > Dear List, > > I have a MySQL database (V5.0.x) and I need to make graphs. > Does anyone know about good utilities to make graphs ? > I would appreciate your expertise or links. > > TIA, Cor > A very good one is BIRT (http://www.eclipse.org/birt/phoenix/) to be deployed in a Tomcat or any other Java server. You can see some tutorials and video tutorials in the examples section of the page. Very easy to use. If you are using PHP, an option is jpgraph (http://www.aditus.nu/*jpgraph*/). Not very complete, and quite difficult to deploy. A commercial solution is Fusion Charts (http://www.infosoftglobal.com/FusionCharts/). Try to be a little bit more explicit about the language you are using ant the kind of graphs you need to generate. Hope this links help you, Regards, Alvaro -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Insert ... Select troubles
Thanks for the suggestion Brent. The auto_increment won't work in my situation though. My t1 table has a RecID field that already is my primary key and set to auto_increment. Is there another way that this can be done? Thanks >>> "Brent Baisley" <[EMAIL PROTECTED]> 1/12/07 1:10 PM >>> Sine ItemCount is part of your unique key, you should just make ItemCount an auto_increment field. Mysql will then handle providing sequential numbering within the group. For example: CREATE TABLE t1 ( GroupCount int, ItemCount int auto_increment, PRIMARY KEY (GroupCount,ItemCount) ) When you do an insert, leave out the ItemCount. insert into t1 (GroupCount) values (1),(1),(2),(2) The t1 table then looks like this; GroupCount ItemCount 11 12 21 22 The compound primary key causes a difference auto increment sequence to be made for each record "group". - Original Message - From: "Ed Reed" <[EMAIL PROTECTED]> To: Sent: Friday, January 12, 2007 12:42 PM Subject: Re: Insert ... Select troubles > ItemCount is essentially a counter of the records from the select > statement. So, every new INSERT ... SELECT statement gets a new > GroupCount (the next number up) and ItemCount represents the ID of the > items in that new group. > > Does that make sense? > > - Thanks > "Michael Dykman" <[EMAIL PROTECTED]> 1/12/07 8:13 AM >>> > On 1/11/07, Ed Reed <[EMAIL PROTECTED]> wrote: >> >> I need some help creating an INSERT * SELECT statement that supplies > a record counter in the returned items. Here's the task, >> >> I have t1 and t2. t1 is GroupCount, ItemCount, Field1, Field2, > Field3. t2 is Field1, Field2, Field3. >> >> t1 has a multiple field unique key called Request that has GroupCount > and ItemCount. I would like to create an INSERT * SELECT statement that > takes the three fields from t2 and puts them into t1 and at the same > time automatically fills the GroupCount and ItemCount field. My data in > t1 should look like this. >> >> > +--+---+--+--+--+ >> |GroupCount| ItemCount | Field1 |Field2| Field3 > | >> > +--+---+--+--+--+ >> |1 | 1 | data from t2 | data from t2 | data from t2 > | >> |1 | 2 | data from t2 | data from t2 | data from t2 > | >> |1 | 3 | data from t2 | data from t2 | data from t2 > | >> |2 | 1 | data from t2 | data from t2 | data from t2 > | >> |2 | 2 | data from t2 | data from t2 | data from t2 > | >> |3 | 1 | data from t2 | data from t2 | data from t2 > | >> |3 | 2 | data from t2 | data from t2 | data from t2 > | >> |3 | 3 | data from t2 | data from t2 | data from t2 > | >> |3 | 4 | data from t2 | data from t2 | data from t2 > | >> |3 | 5 | data from t2 | data from t2 | data from t2 > | >> |3 | 6 | data from t2 | data from t2 | data from t2 > | >> |4 | 1 | data from t2 | data from t2 | data from t2 > | >> |4 | 2 | data from t2 | data from t2 | data from t2 > | >> |4 | 3 | data from t2 | data from t2 | data from t2 > | >> |4 | 4 | data from t2 | data from t2 | data from t2 > | >> |4 | 5 | data from t2 | data from t2 | data from t2 > | >> |4 | 6 | data from t2 | data from t2 | data from t2 > | >> |4 | 7 | data from t2 | data from t2 | data from t2 > | >> |5 | 1 | data from t2 | data from t2 | data from t2 > | >> |5 | 2 | data from t2 | data from t2 | data from t2 > | >> |6 | 1 | data from t2 | data from t2 | data from t2 > | >> |6 | 2 | data from t2 | data from t2 | data from t2 > | >> |6 | 3 | data from t2 | data from t2 | data from t2 > | >> > +--+---+--+--+--+ >> >> I can figure most of it out with the exception of the ItemCount > value. What I have so far is this, >> >> INSERT INTO t1 (GroupCount, ItemCount, Field1, Field2, Field3) SELECT > (SELECT Max(GroupCount)+1 From t1), ?, Field1, Field2, Field3 FROM > t2; >> >> The part with the ? is what I can't figure out. >> >> Any ideas? >> > > I'm not very clear what ItemCount is supposed to represent.. if you > restate it, perhaps I can help > > -- > - michael dykman > - [EMAIL PROTECTED] >
Re: making graphs with MySQL data
On Friday 12 January 2007 12:51, C.R.Vegelin wrote: > Dear List, > > I have a MySQL database (V5.0.x) and I need to make graphs. > Does anyone know about good utilities to make graphs ? > I would appreciate your expertise or links. If you're using Python, matplotlib is an excellent package. If you want something fully graphical, you can connect MS Excel (and OO Calc) to backend databases and query data. j -- Joshua Kugler Lead System Admin -- Senior Programmer http://www.eeinternet.com PGP Key: http://pgp.mit.edu/ ID 0xDB26D7CE PO Box 80086 -- Fairbanks, AK 99708 -- Ph: 907-456-5581 Fax: 907-456-3111 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Problems with INSERT
> I keep getting the following error: > > 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 's > resources than dual monitor mode to generate the video output. Running > in dual' at line 2 > > when I try to add: > > Note : Single-monitor mode uses more of your computer's resources than > dual monitor mode to generate the video output. Running in dual monitor > mode is recommended because it is more efficient. > > > My PHP code to add Q & A is: > > mysql_query("INSERT INTO faqs > (Question, Answer, Category, Date) VALUES('$question', '$answer', > '$category', CURDATE() ) ") > or die(mysql_error()); > > If I enter the above text directly intophpMyAdmin, all is fine. > > Any help is greatly appreciated. > > Thanks > > Haig Haig, $questionEscaped = mysql_real_escape_string($question); mysql_query("INSERT INTO faqs (Question, Answer, Category, Date) VALUES('$questionEscaped', '$answer', '$category', CURDATE() ) ") or die(mysql_error()); You need to escape the single quote in your FAQ. David
RE: Problems with INSERT
[snip] 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 's resources than dual monitor mode to generate the video output. Running in dual' at line 2 when I try to add: Note : Single-monitor mode uses more of your computer's resources than dual monitor mode to generate the video output. Running in dual monitor mode is recommended because it is more efficient. My PHP code to add Q & A is: mysql_query("INSERT INTO faqs (Question, Answer, Category, Date) VALUES('$question', '$answer', '$category', CURDATE() ) ") or die(mysql_error()); [/snip] You need to escape your $question and $answer variables, the apostrophe's contained there are goofing you up. http://www.php.net/mysqlrealescapestring -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Problems with INSERT
Hi everyone, I'm a dbase rookie and I've ran into a small problem. I created a basic faq table and all is fine regarding displaying & searching the Q & A's on a web page. Up until now, I;ve entered all Q & A's from phpMyAdmin. I'm trying to create an admin page to enter the Q & A's and for the most part, it's working. However, I keep getting the following error: 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 's resources than dual monitor mode to generate the video output. Running in dual' at line 2 when I try to add: Note : Single-monitor mode uses more of your computer's resources than dual monitor mode to generate the video output. Running in dual monitor mode is recommended because it is more efficient. My PHP code to add Q & A is: mysql_query("INSERT INTO faqs (Question, Answer, Category, Date) VALUES('$question', '$answer', '$category', CURDATE() ) ") or die(mysql_error()); If I enter the above text directly intophpMyAdmin, all is fine. Any help is greatly appreciated. Thanks Haig -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Insert ... Select troubles
Sine ItemCount is part of your unique key, you should just make ItemCount an auto_increment field. Mysql will then handle providing sequential numbering within the group. For example: CREATE TABLE t1 ( GroupCount int, ItemCount int auto_increment, PRIMARY KEY (GroupCount,ItemCount) ) When you do an insert, leave out the ItemCount. insert into t1 (GroupCount) values (1),(1),(2),(2) The t1 table then looks like this; GroupCount ItemCount 11 12 21 22 The compound primary key causes a difference auto increment sequence to be made for each record "group". - Original Message - From: "Ed Reed" <[EMAIL PROTECTED]> To: Sent: Friday, January 12, 2007 12:42 PM Subject: Re: Insert ... Select troubles ItemCount is essentially a counter of the records from the select statement. So, every new INSERT ... SELECT statement gets a new GroupCount (the next number up) and ItemCount represents the ID of the items in that new group. Does that make sense? - Thanks "Michael Dykman" <[EMAIL PROTECTED]> 1/12/07 8:13 AM >>> On 1/11/07, Ed Reed <[EMAIL PROTECTED]> wrote: I need some help creating an INSERT * SELECT statement that supplies a record counter in the returned items. Here's the task, I have t1 and t2. t1 is GroupCount, ItemCount, Field1, Field2, Field3. t2 is Field1, Field2, Field3. t1 has a multiple field unique key called Request that has GroupCount and ItemCount. I would like to create an INSERT * SELECT statement that takes the three fields from t2 and puts them into t1 and at the same time automatically fills the GroupCount and ItemCount field. My data in t1 should look like this. +--+---+--+--+--+ |GroupCount| ItemCount | Field1 |Field2| Field3 | +--+---+--+--+--+ |1 | 1 | data from t2 | data from t2 | data from t2 | |1 | 2 | data from t2 | data from t2 | data from t2 | |1 | 3 | data from t2 | data from t2 | data from t2 | |2 | 1 | data from t2 | data from t2 | data from t2 | |2 | 2 | data from t2 | data from t2 | data from t2 | |3 | 1 | data from t2 | data from t2 | data from t2 | |3 | 2 | data from t2 | data from t2 | data from t2 | |3 | 3 | data from t2 | data from t2 | data from t2 | |3 | 4 | data from t2 | data from t2 | data from t2 | |3 | 5 | data from t2 | data from t2 | data from t2 | |3 | 6 | data from t2 | data from t2 | data from t2 | |4 | 1 | data from t2 | data from t2 | data from t2 | |4 | 2 | data from t2 | data from t2 | data from t2 | |4 | 3 | data from t2 | data from t2 | data from t2 | |4 | 4 | data from t2 | data from t2 | data from t2 | |4 | 5 | data from t2 | data from t2 | data from t2 | |4 | 6 | data from t2 | data from t2 | data from t2 | |4 | 7 | data from t2 | data from t2 | data from t2 | |5 | 1 | data from t2 | data from t2 | data from t2 | |5 | 2 | data from t2 | data from t2 | data from t2 | |6 | 1 | data from t2 | data from t2 | data from t2 | |6 | 2 | data from t2 | data from t2 | data from t2 | |6 | 3 | data from t2 | data from t2 | data from t2 | +--+---+--+--+--+ I can figure most of it out with the exception of the ItemCount value. What I have so far is this, INSERT INTO t1 (GroupCount, ItemCount, Field1, Field2, Field3) SELECT (SELECT Max(GroupCount)+1 From t1), ?, Field1, Field2, Field3 FROM t2; The part with the ? is what I can't figure out. Any ideas? I'm not very clear what ItemCount is supposed to represent.. if you restate it, perhaps I can help -- - michael dykman - [EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: making graphs with MySQL data
C.R.Vegelin wrote: Dear List, I have a MySQL database (V5.0.x) and I need to make graphs. Does anyone know about good utilities to make graphs ? I would appreciate your expertise or links. TIA, Cor Perl with GD? MS Access/MyODBC could do it too. You may have to be more specific. -Ryan -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
making graphs with MySQL data
Dear List, I have a MySQL database (V5.0.x) and I need to make graphs. Does anyone know about good utilities to make graphs ? I would appreciate your expertise or links. TIA, Cor
RE: Selecting records based on max and value
Thanks! I'll make the column type change. Thanks, David Ruggles CCNA MCSE (NT) CNA A+ Network EngineerSafe Data, Inc. (910) 285-7200 [EMAIL PROTECTED] -Original Message- From: Peter Brawley [mailto:[EMAIL PROTECTED] Sent: Friday, January 12, 2007 3:42 PM To: David Ruggles Cc: 'mysql' Subject: Re: Selecting records based on max and value David, >I want to select for a given date all sites that have >the last history record with a certain status. Try something like ... SELECT h1.supplyorderid FROM supplyorder o JOIN supplyorderhistory h1 ON o.uid=h1.supplyorderuid LEFT JOIN supplyorderhistory h2 ON h2.supplyorderuid = h.supplyorderuid AND h1.status=2 AND h1.uid < h2.uid WHERE o.date= AND h2.uid IS NULL There's a brief discussion of this query pattern at http://www.artfulsoftware.com/mysql-queries.php; in the left panel click on 'Aggregates' then on 'Within-group aggregates'. BTW your id columns should be ints not doubles, bigints if you expect huge rowcounts. Likewise status. PB - David Ruggles wrote: > I'm new to this list, but have searched through the archives and haven't > found anything that addresses my question. > > First a little background: > > I'm creating a supply ordering system. Each supply order may be modified > many times before being approved and finally filled. > > I created the following databases: > > Supplyorder > uid double (auto) (pk) > sitedouble > datedate > > Supplyorderhistory > uid double (auto) (pk) > supplyorderuid double > status double > > Supplyorderlineitems > uid double (auto) (pk) > supplyorderhistoryuid double > other fields ... > > Each time an existing supply order is modified a new history record is > created so we have a paper trail of all the changes made to the order and > the specific line items ordered are associated with the history record. > > I want to select for a given date all sites that have the last history > record with a certain status. > > This will select the last history record for each site: > > SELECT MAX(h.uid), site FROM supplyorder AS s, supplyorderhistory AS h > WHERE h.supplyorderuid = s.uid AND date = '2007-01-08' GROUP BY s.uid > > But if I do this: > > SELECT MAX(h.uid), site FROM supplyorder AS s, supplyorderhistory AS h > WHERE h.supplyorderuid = s.uid AND date = '2007-01-08' and status = '2' > GROUP BY s.uid > > Max just becomes the last history record with a status of 2. I understand > why it is working this way and that it is working correctly, I just don't > know how to get what I want out of it. > > Thanks in advance for any help. > > Thanks, > > David Ruggles > CCNA MCSE (NT) CNA A+ > Network Engineer Safe Data, Inc. > (910) 285-7200[EMAIL PROTECTED] > > > > -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.410 / Virus Database: 268.16.10/624 - Release Date: 1/12/2007 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Row position in table when sorted?
[EMAIL PROTECTED] (Nuno Oliveira) wrote in news:[EMAIL PROTECTED]: > (Off-Topic: I'm using Thunderbird/1.5 & Gmail and I do a Reply All > which sends the messages to the person I'm replying and CC's to the > list but I never receive my own messages. Is this the normal behavior? > Thanks) Looking at the headers it seems your cc: address is different from the from: address. Personally I follow these lists through nntp:lists.mysql.com with a newsreader. -- felix -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Selecting records based on max and value
David, I want to select for a given date all sites that have the last history record with a certain status. Try something like ... SELECT h1.supplyorderid FROM supplyorder o JOIN supplyorderhistory h1 ON o.uid=h1.supplyorderuid LEFT JOIN supplyorderhistory h2 ON h2.supplyorderuid = h.supplyorderuid AND h1.status=2 AND h1.uid < h2.uid WHERE o.date= AND h2.uid IS NULL There's a brief discussion of this query pattern at http://www.artfulsoftware.com/mysql-queries.php; in the left panel click on 'Aggregates' then on 'Within-group aggregates'. BTW your id columns should be ints not doubles, bigints if you expect huge rowcounts. Likewise status. PB - David Ruggles wrote: I'm new to this list, but have searched through the archives and haven't found anything that addresses my question. First a little background: I'm creating a supply ordering system. Each supply order may be modified many times before being approved and finally filled. I created the following databases: Supplyorder uid double (auto) (pk) sitedouble datedate Supplyorderhistory uid double (auto) (pk) supplyorderuid double status double Supplyorderlineitems uid double (auto) (pk) supplyorderhistoryuid double other fields ... Each time an existing supply order is modified a new history record is created so we have a paper trail of all the changes made to the order and the specific line items ordered are associated with the history record. I want to select for a given date all sites that have the last history record with a certain status. This will select the last history record for each site: SELECT MAX(h.uid), site FROM supplyorder AS s, supplyorderhistory AS h WHERE h.supplyorderuid = s.uid AND date = '2007-01-08' GROUP BY s.uid But if I do this: SELECT MAX(h.uid), site FROM supplyorder AS s, supplyorderhistory AS h WHERE h.supplyorderuid = s.uid AND date = '2007-01-08' and status = '2' GROUP BY s.uid Max just becomes the last history record with a status of 2. I understand why it is working this way and that it is working correctly, I just don't know how to get what I want out of it. Thanks in advance for any help. Thanks, David Ruggles CCNA MCSE (NT) CNA A+ Network EngineerSafe Data, Inc. (910) 285-7200 [EMAIL PROTECTED] -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.410 / Virus Database: 268.16.10/624 - Release Date: 1/12/2007 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Row position in table when sorted?
Jerry Schwartz wrote: Now that I re-read your question, I think your answer is that the LIMIT clause applies to the set of records retrieved after all of the conditions are applied. In your example, SELECT * FROM clients WHERE name LIKE "Mark%" ORDER BY name LIMIT 1, 7; Then SELECT * FROM clients WHERE name LIKE "Mark%" ORDER BY name LIMIT 8, 7; Is that what you were asking? Have you looked at using the HANDLER statement? [...] Well... Yes and No! Yes, The examples that you provided with the LIMIT would work but... Yes, that could be be what I was asking but it doesn't fit on my needs. You guys don't have access to my code because if you have you would know that I'm just a beginner and my code wouldn't be "compatible" with your suggestions. But not everything is bad news... Now I know that the values that I set with LIMIT are not related with the position of my data in the table but to the position of the data after I apply a filter (WHERE)... I will reprogram the Show Client page to use WHERE RelationID=#NUM# instead of LIMIT #NUM#,1 So... Thank you guys and I will probably come back :) (Off-Topic: I'm using Thunderbird/1.5 & Gmail and I do a Reply All which sends the messages to the person I'm replying and CC's to the list but I never receive my own messages. Is this the normal behavior? Thanks) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: [OT} How to pronounce GIF
In an effort to quell this off-topic and rather pointless dialog, allow me to refer you to the Wikipedia article on the subject: http://en.wikipedia.org/wiki/GIF Specifically the section: "According to the creator of the "GIF" format, Steve Wilhite, the pronunciation is with a soft "g" and the acronym is pronounced like the peanut butter brand, Jif. To fellow employees of CompuServe he would often say "Choosy developers choose GIF", spinning off of the historically popular peanut butter commercial. This pronunciation was also identified by CompuServe in their documentation of a graphics display program called CompuShow. " "GIF" is not a word, it's an acronym, therefore "precedent in English" has no bearing. Eric John Trammell wrote: Way offoptic now How do you pronounce "gift"? :^) $ egrep '^gif' /usr/share/dict/words gift gift's gifted gifting gifts To heck with the spec, all precedent in English says hard G. Next they'll tell us to pronounce "jpeg" as "gay-peg". -Original Message- From: Gerald L. Clark [mailto:[EMAIL PROTECTED] Sent: Friday, January 12, 2007 1:04 PM To: Brian Dunning Cc: mysql Subject: Re: [OT} How to pronounce GIF Brian Dunning wrote: On Jan 7, 2007, at 4:23 PM, TK wrote: In short, the original inventors of the GIF format (CompuServe, 1987) have always defined the pronunciation to be like "JIF." So, that has always been the "correct" pronunciation. Sure, so I'll start pronouncing "graphics" as "jraphics". How do you pronounce "giraffe"? -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Selecting records based on max and value
I'm new to this list, but have searched through the archives and haven't found anything that addresses my question. First a little background: I'm creating a supply ordering system. Each supply order may be modified many times before being approved and finally filled. I created the following databases: Supplyorder uid double (auto) (pk) sitedouble datedate Supplyorderhistory uid double (auto) (pk) supplyorderuid double status double Supplyorderlineitems uid double (auto) (pk) supplyorderhistoryuid double other fields ... Each time an existing supply order is modified a new history record is created so we have a paper trail of all the changes made to the order and the specific line items ordered are associated with the history record. I want to select for a given date all sites that have the last history record with a certain status. This will select the last history record for each site: SELECT MAX(h.uid), site FROM supplyorder AS s, supplyorderhistory AS h WHERE h.supplyorderuid = s.uid AND date = '2007-01-08' GROUP BY s.uid But if I do this: SELECT MAX(h.uid), site FROM supplyorder AS s, supplyorderhistory AS h WHERE h.supplyorderuid = s.uid AND date = '2007-01-08' and status = '2' GROUP BY s.uid Max just becomes the last history record with a status of 2. I understand why it is working this way and that it is working correctly, I just don't know how to get what I want out of it. Thanks in advance for any help. Thanks, David Ruggles CCNA MCSE (NT) CNA A+ Network EngineerSafe Data, Inc. (910) 285-7200 [EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: [OT} How to pronounce GIF
Way offoptic now How do you pronounce "gift"? :^) $ egrep '^gif' /usr/share/dict/words gift gift's gifted gifting gifts To heck with the spec, all precedent in English says hard G. Next they'll tell us to pronounce "jpeg" as "gay-peg". -Original Message- From: Gerald L. Clark [mailto:[EMAIL PROTECTED] Sent: Friday, January 12, 2007 1:04 PM To: Brian Dunning Cc: mysql Subject: Re: [OT} How to pronounce GIF Brian Dunning wrote: > On Jan 7, 2007, at 4:23 PM, TK wrote: > >> In short, the original inventors of the GIF format (CompuServe, >> 1987) have always defined the pronunciation to be like "JIF." So, >> that has always been the "correct" pronunciation. > > > Sure, so I'll start pronouncing "graphics" as "jraphics". > > How do you pronounce "giraffe"? -- Gerald L. Clark Supplier Systems Corporation -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] INFORMATION IN THIS MESSAGE, INCLUDING ANY ATTACHMENTS, IS INTENDED FOR THE PERSONAL AND CONFIDENTIAL USE OF THE INTENDED RECIPIENT(S) NAMED ABOVE. If you are not an intended recipient of this message, or an agent responsible for delivering it to an intended recipient, you are hereby notified that you have received this message in error, and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you received this message in error, please notify the sender immediately, delete the message, and return any hard copy print-outs. This message has been scanned for viruses by McAfee's Groupshield. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: [OT} How to pronounce GIF
Brian Dunning wrote: On Jan 7, 2007, at 4:23 PM, TK wrote: In short, the original inventors of the GIF format (CompuServe, 1987) have always defined the pronunciation to be like "JIF." So, that has always been the "correct" pronunciation. Sure, so I'll start pronouncing "graphics" as "jraphics". How do you pronounce "giraffe"? -- Gerald L. Clark Supplier Systems Corporation -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: [OT} How to pronounce GIF (was: Re: How to pronounce MyISAM and InnoDB)
... Especially for tall ones. Regards, Jerry Schwartz Global Information Incorporated 195 Farmington Ave. Farmington, CT 06032 860.674.8796 / FAX: 860.674.8341 > -Original Message- > From: Brian Dunning [mailto:[EMAIL PROTECTED] > Sent: Friday, January 12, 2007 1:49 PM > To: mysql > Subject: Re: [OT} How to pronounce GIF (was: Re: How to > pronounce MyISAM and InnoDB) > > On Jan 7, 2007, at 4:23 PM, TK wrote: > > > In short, the original inventors of the GIF format (CompuServe, > > 1987) have always defined the pronunciation to be like "JIF." So, > > that has always been the "correct" pronunciation. > > Sure, so I'll start pronouncing "graphics" as "jraphics". > > > -- > 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: Row position in table when sorted?
Now that I re-read your question, I think your answer is that the LIMIT clause applies to the set of records retrieved after all of the conditions are applied. In your example, SELECT * FROM clients WHERE name LIKE "Mark%" ORDER BY name LIMIT 1, 7; Then SELECT * FROM clients WHERE name LIKE "Mark%" ORDER BY name LIMIT 8, 7; Is that what you were asking? Have you looked at using the HANDLER statement? That would eliminate the need to do a SELECT statement for every page, although you'd have to reset the pointer and still use LIMIT clauses. It would look something like this: Regards, Jerry Schwartz Global Information Incorporated 195 Farmington Ave. Farmington, CT 06032 860.674.8796 / FAX: 860.674.8341 > -Original Message- > From: Nuno Oliveira [mailto:[EMAIL PROTECTED] > Sent: Friday, January 12, 2007 10:05 AM > To: mysql@lists.mysql.com > Subject: Row position in table when sorted? > > Hello, > > I'm working on a web site which have a page for the admin > to browse the clients table in a database. > > To facilitate the interaction, I'm ORDERing BY Name... > > The pagination buttons in this page are something like: > > href=".?Page=7" > > and when loaded, it will > > "SELECT * FROM Clients ORDER BY Name LIMIT 7,1" > > This is working perfectly but now I have a problem. > I've done a page to find a client and I display the > clients names in a table (Using CSS) but I don't know > where to link to??? I apply a query and retrieve let's > say 14 clients that match. What should the LIMIT value??? > This is what I don't know how to do... Please help? > > Is there a way to know the position of a certain row if > all the rows are selected and in a specific order? > > Thanks > > -- > 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: [OT} How to pronounce GIF (was: Re: How to pronounce MyISAM and InnoDB)
On Jan 7, 2007, at 4:23 PM, TK wrote: In short, the original inventors of the GIF format (CompuServe, 1987) have always defined the pronunciation to be like "JIF." So, that has always been the "correct" pronunciation. Sure, so I'll start pronouncing "graphics" as "jraphics". -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Insert ... Select troubles
ItemCount is essentially a counter of the records from the select statement. So, every new INSERT ... SELECT statement gets a new GroupCount (the next number up) and ItemCount represents the ID of the items in that new group. Does that make sense? - Thanks >>> "Michael Dykman" <[EMAIL PROTECTED]> 1/12/07 8:13 AM >>> On 1/11/07, Ed Reed <[EMAIL PROTECTED]> wrote: > > I need some help creating an INSERT * SELECT statement that supplies a record counter in the returned items. Here's the task, > > I have t1 and t2. t1 is GroupCount, ItemCount, Field1, Field2, Field3. t2 is Field1, Field2, Field3. > > t1 has a multiple field unique key called Request that has GroupCount and ItemCount. I would like to create an INSERT * SELECT statement that takes the three fields from t2 and puts them into t1 and at the same time automatically fills the GroupCount and ItemCount field. My data in t1 should look like this. > > +--+---+--+--+--+ > |GroupCount| ItemCount | Field1 |Field2| Field3 | > +--+---+--+--+--+ > |1 | 1 | data from t2 | data from t2 | data from t2 | > |1 | 2 | data from t2 | data from t2 | data from t2 | > |1 | 3 | data from t2 | data from t2 | data from t2 | > |2 | 1 | data from t2 | data from t2 | data from t2 | > |2 | 2 | data from t2 | data from t2 | data from t2 | > |3 | 1 | data from t2 | data from t2 | data from t2 | > |3 | 2 | data from t2 | data from t2 | data from t2 | > |3 | 3 | data from t2 | data from t2 | data from t2 | > |3 | 4 | data from t2 | data from t2 | data from t2 | > |3 | 5 | data from t2 | data from t2 | data from t2 | > |3 | 6 | data from t2 | data from t2 | data from t2 | > |4 | 1 | data from t2 | data from t2 | data from t2 | > |4 | 2 | data from t2 | data from t2 | data from t2 | > |4 | 3 | data from t2 | data from t2 | data from t2 | > |4 | 4 | data from t2 | data from t2 | data from t2 | > |4 | 5 | data from t2 | data from t2 | data from t2 | > |4 | 6 | data from t2 | data from t2 | data from t2 | > |4 | 7 | data from t2 | data from t2 | data from t2 | > |5 | 1 | data from t2 | data from t2 | data from t2 | > |5 | 2 | data from t2 | data from t2 | data from t2 | > |6 | 1 | data from t2 | data from t2 | data from t2 | > |6 | 2 | data from t2 | data from t2 | data from t2 | > |6 | 3 | data from t2 | data from t2 | data from t2 | > +--+---+--+--+--+ > > I can figure most of it out with the exception of the ItemCount value. What I have so far is this, > > INSERT INTO t1 (GroupCount, ItemCount, Field1, Field2, Field3) SELECT (SELECT Max(GroupCount)+1 From t1), ?, Field1, Field2, Field3 FROM t2; > > The part with the ? is what I can't figure out. > > Any ideas? > I'm not very clear what ItemCount is supposed to represent.. if you restate it, perhaps I can help -- - michael dykman - [EMAIL PROTECTED]
Re: Row position in table when sorted?
[EMAIL PROTECTED] (Nuno Oliveira) wrote in news:[EMAIL PROTECTED]: > My problem/question is how can I know the link for each one of these > found records??? Which is the for the LIMIT??? The way to retrieve individual records is by id, not by LIMIT n, m: SELECT * FROM Clients WHERE id = <> and *not* SELECT * FROM Clients ORDER BY Name LIMIT n, 1 -- felix -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
How to randomly select one value per group-by column?
Dear list, Suppose a table with articles that persons have ordered: create table t (pers_id int(6), odate date, art_id int(8)) I want to select one randomly choosen odate for every pers_id. I can easily select the minimum or the maximum odate: select pers_id, min(odate) from t group by pers_id What would like is something like: select pers_id, random_select(odate) from t group by pers_id Does anyone know how to do this? Cheers, Paul -- Paul B van den Berg, Manager InterAction database, http://www.iadb.nl Dept of Social Pharmacy, Pharmacoepidemiology and Pharmacotherapeutics -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Row position in table when sorted?
Rolando Edwards wrote: I think you need this syntax SELECT * FROM Clients ORDER BY Name LIMIT , Your offset must be rows per page * pagenumber where minimum pagenumber is 0 You should also count the full result set divide that count by the number of rows per page to get the last page number If the remainder is not zero, then add one to the max pagenumber Yes!! But that's what I have already done and it is working :) My problem is, when I go to the "find client" page and enter a client name, and for example receive 14 results that match, then I don't know what is the offset that I should use to link to the page that displays the client info for each one of those results... Let me try to explain with an example: Table Clients = 01 Ana Lucia 02 Mark David 03 George Carlin 04 Nelson Martin 05 Xavier Pitt 06 Martin Luther 07 Tony Andrew 08 Mark Donald 09 Petter James When I'm navigating the clients page, I'm seeing all this ID's, names, and a lot more information... In that page I have buttons First 335 336 337 <338> 339 340 341 Last I'm ordering by client name so my table looks like this Table Clients = 01 Ana Lucia 03 George Carlin 02 Mark David 08 Mark Donald 06 Martin Luther 04 Nelson Martin 09 Petter James 07 Tony Andrew 05 Xavier Pitt Each one of this buttons links to one of this pages, for example, if a user clicks on 337 it links to href="clients.php?recID=337" 337 is not the ID of the client but the position of the client in the table when ordered by client name. When I search for a client "Mar" the WHERE will add a % and I will query with WHERE Name LIKE 'Mar%' This way I will retrieve the records Mark David Mark Donald Martin Luther My problem/question is how can I know the link for each one of these found records??? Which is the for the LIMIT??? In this case, by watching to the tables above I know that the limits would be 3, 4 and 5 but how can I know this with php/MySQL code? Thanks -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Row position in table when sorted?
I think you need this syntax SELECT * FROM Clients ORDER BY Name LIMIT , Your offset must be rows per page * pagenumber where minimum pagenumber is 0 You should also count the full result set divide that count by the number of rows per page to get the last page number If the remainder is not zero, then add one to the max pagenumber - Original Message - From: Nuno Oliveira <[EMAIL PROTECTED]> To: mysql@lists.mysql.com Sent: Friday, January 12, 2007 10:04:34 AM GMT-0500 US/Eastern Subject: Row position in table when sorted? Hello, I'm working on a web site which have a page for the admin to browse the clients table in a database. To facilitate the interaction, I'm ORDERing BY Name... The pagination buttons in this page are something like: href=".?Page=7" and when loaded, it will "SELECT * FROM Clients ORDER BY Name LIMIT 7,1" This is working perfectly but now I have a problem. I've done a page to find a client and I display the clients names in a table (Using CSS) but I don't know where to link to??? I apply a query and retrieve let's say 14 clients that match. What should the LIMIT value??? This is what I don't know how to do... Please help? Is there a way to know the position of a certain row if all the rows are selected and in a specific order? Thanks -- 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]
Row position in table when sorted?
Hello, I'm working on a web site which have a page for the admin to browse the clients table in a database. To facilitate the interaction, I'm ORDERing BY Name... The pagination buttons in this page are something like: href=".?Page=7" and when loaded, it will "SELECT * FROM Clients ORDER BY Name LIMIT 7,1" This is working perfectly but now I have a problem. I've done a page to find a client and I display the clients names in a table (Using CSS) but I don't know where to link to??? I apply a query and retrieve let's say 14 clients that match. What should the LIMIT value??? This is what I don't know how to do... Please help? Is there a way to know the position of a certain row if all the rows are selected and in a specific order? Thanks -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
UTF-8 sorting problem
Hello I've got a problem,, I've tried to search the archive for this list with no luck. Maybe it's because Unicode problems isn't that rare... Anyway .. Here is my problem. Sorting on a VARCHAR collate utf8_swedish_ci (table with default charset utf8).. As many probably know, in Swedish we have the letters ÅÄÖåäö. If I have a table which has default charset utf8 and collate utf8_swedish_ci and I sort the result on a VARCHAR, the letters ÅÄÖåäö comes in between the 'normal' letters A-Z .. They should be last, after Z in order: ÅÄÖ eg. mysql>CREATE TABLE utftest (c1 VARCHAR(30) COLLATE utf8_swedish_ci) default charset utf8; mysql>insert into utftest (c1) VALUES ('A'); mysql>insert into utftest (c1) VALUES (''); mysql>insert into utftest (c1) VALUES ('Z'); mysql>insert into utftest (c1) VALUES ('Å'); mysql>insert into utftest (c1) VALUES ('Ä'); mysql>insert into utftest (c1) VALUES ('Ö'); mysql>select c1 from utftest order by c1; c1 A Ö Å Ä Z >total mess.. between A-Z and not the correct ÅÄÖ-order. If I instead do this !and! change the encoding for my terminal to ISO-8859-1 mysql>CREATE TABLE utftest2 (c1 VARCHAR(30) CHARSET utf8) default charset latin1; mysql>insert into utftest (c1) VALUES ('A'); mysql>insert into utftest (c1) VALUES (''); mysql>insert into utftest (c1) VALUES ('Z'); mysql>insert into utftest (c1) VALUES ('Å'); mysql>insert into utftest (c1) VALUES ('Ä'); mysql>insert into utftest (c1) VALUES ('Ö'); mysql>select c1 from utftest order by c1; c1 A Ö Å Ä Z - Gives the exact same answer as before, but mysql>select c1 from utftest order by c1 collate utf8_swedish_ci; c1 A Z Å Ä Ö >CORRECT I'm starting to get lost with every possible collate/charset configuration... The sollution that gives the correct answer isn't really possible in my situation. I have a 30k+ lines application and that one has been reconfigured to receive the data in utf8-format, therefor also saving it in MySQL as utf8. What can I do? As it is now, the data is saved as utf8, the columns/tables in MySQL are created as utf8 tables .. but MySQL can't seem to sort this correctly.. This is my current configuration -- mysql>status Server version: 5.0.24a-Debian_9-log mysql>show variables like 'character_set%'; Variable_name | Value character_set_client | latin1 character_set_connection | latin1 character_set_database | latin1 character_set_filesystem | binary character_set_results | latin1 character_set_server | latin1 character_set_system | utf8 Running on Kubuntu 6.10 Edgy $ export|grep LANG declare -x LANG="en_US.UTF-8" -- Regards Joakim Lemström, Bytewize AB, Sweden
no caching of Stored Procedure results?
I am using MySql 5.1.14-beta with Java/ConnectorJ on the client. Section '5.14. The MySQL Query Cache' states 'The query cache is not used for server-side prepared statements' and I have confirmed that the results of a stored procedure that makes use of a passed in parameter are not in fact stored into the query cache. I did not realize this before putting a lot of work into my stored procs. I did so partly because of the performance benefits (I thought) of using stored procedures but I now find that I am missing out on a major performance enhancement -- results caching. The stored procs I am concerned about only contain selects. I know that stored procs are complicated for the cahcing system to analyze but it seems that MySQL could know if a stored proc contains only selects (or made use of my annotation 'DETERMINISTIC READS SQL DATA') that it would then be able to cache the results. Anyone have suggestions to enable me to get caching on the mysql server for the selects inside my stored procs? I could move the selects out to my client code but I would prefer not to -- one of my reasons for using sp's was so that I could limit the permissions of my client user to execute permissions only for designated sprocs and no select permissions. Thanks, Peter Andrews -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Dual Hardisk
Hi, Your storage engine is Innodb?. If your answer is yes, please see below : innodb_data_file_path=/u01/ibdata1:50M;/u01/ibdata2:50M*;/u03/ibdata3:100M * You can create a new ibdata ( tablespace) in a new device : 1) Stop mysql 2) Change conf ( add new one tablespace) 3) start mysql Regards, Juan On 1/11/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: Hi, I have a database named X on a hardisk, and the hardisk can not store new record because it has no space anymore. Can I just add a new hardisk and ask MySQL to store new record for database X to the new hardisk? Please share me the knowledge to do it, many thanks for your helps. Regards Willy -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
Re: Primary key
> In the last episode (Jan 11), Steffan A. Cline said: >> Is there anyway to do a SELECT or DESCRIBE or SHOW statement which can >> return the primary key field of a specified table? >> >> Pseudo code: select primary_key_field_name from mytable. > > SELECT * FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE > WHERE TABLE_SCHEMA='myschema' AND TABLE_NAME='mytable' > AND CONSTRAINT_NAME='PRIMARY' > ORDER BY ORDINAL_POSITION; > > For multi-column indexes, you will get multiple rows back. > > You should also use "show create table mytable" or "show keys from > mytable" but you'll have to do extra parsing. Dan, Great! This is what I was after... I am building a class/ctype for Lasso for a user db. When it is instantiated, it loads the structure into the type from the db. Now, I have the primary key as the ID of the type I need to separate it from the rest of the columns. SO, I guess now I'll work on unless you have it handy where I can return all columns EXCEPT the primary key. Thanks Steffan --- T E L 6 0 2 . 5 7 9 . 4 2 3 0 | F A X 6 0 2 . 9 7 1 . 1 6 9 4 Steffan A. Cline [EMAIL PROTECTED] Phoenix, Az http://www.ExecuChoice.net USA AIM : SteffanC ICQ : 57234309 Lasso Partner Alliance Member --- > From: Dan Nelson <[EMAIL PROTECTED]> > Date: Fri, 12 Jan 2007 01:00:03 -0600 > To: "Steffan A. Cline" <[EMAIL PROTECTED]> > Cc: > Subject: Re: Primary key > > In the last episode (Jan 11), Steffan A. Cline said: >> Is there anyway to do a SELECT or DESCRIBE or SHOW statement which can >> return the primary key field of a specified table? >> >> Pseudo code: select primary_key_field_name from mytable. > > SELECT * FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE > WHERE TABLE_SCHEMA='myschema' AND TABLE_NAME='mytable' > AND CONSTRAINT_NAME='PRIMARY' > ORDER BY ORDINAL_POSITION; > > For multi-column indexes, you will get multiple rows back. > > You should also use "show create table mytable" or "show keys from > mytable" but you'll have to do extra parsing. > > -- > Dan Nelson > [EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: Need any that can translate this
Oh my god it work.Thank you very much Felix (thanks all for answer). I don't have knowlege in MySql. Thanks thanks thanks. I have one more select (the last), if you can help me with this please. SELECT * FROM login_users WHERE id IN (SELECT o.user_id from orders o,facturas f where factura_id='".$order."' AND o.orders_id=f.pedido); Thanks all, Tomás -Mensaje original- De: Felix Geerinckx [mailto:[EMAIL PROTECTED] Enviado el: jueves, 11 de enero de 2007 19:25 Para: mysql@lists.mysql.com Asunto: Re: Need any that can translate this [EMAIL PROTECTED] (Tomás Abad Fernández) wrote in news:[EMAIL PROTECTED]: > I dont know why thease don't work at MySql 3.21 , anyone can help me > to make this compatible with mysql3? 3.21 is really ancient ... > > $query = "SELECT * FROM facturas WHERE pedido IN (SELECT orders_id > FROM orders WHERE user_id='".$user."') ORDER BY factura_id"; ... don't even know if this will work: SELECT DISTINCT f.* FROM facturas f, orders o WHERE f.pedido = o.orders_id AND o.user_id = '$user' ORDER BY f.factura_id; -- felix -- 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]