Best SQL Statement
Dear All, I have a table contains airline ticket prices, and I want to get the following data from this table The first 5 records of the lowest price of each airline from each city, and don't want to get a duplicated combination of (airline, city) in this result (even if I didn't see all airlines or all cities, I want to see only five records). I get the required results (in MSAccess) by doing the following: 1- Create a query Q1 with the following source: SELECT distinct [ticket cut rate].[primary airline] FROM [ticket cut rate] 2- Then Create a second Query Q2 with the following source: SELECT Q1.[primary airline], Min([ticket cut rate].[price per adult]) AS [MinOfprice per adult] FROM Q1 INNER JOIN [ticket cut rate] ON Q1.[primary airline] = [ticket cut rate].[primary airline] GROUP BY Q1.[primary airline]; 3- And I get the required results from the following Query: SELECT TOP 5 First([ticket cut rate].origin) AS FirstOforigin, [ticket cut rate].[primary airline], [ticket cut rate].[price per adult] FROM (Q1 INNER JOIN Q2 ON Q1.[primary airline] = Q2.[primary airline]) INNER JOIN [ticket cut rate] ON (Q2.[primary airline] = [ticket cut rate].[primary airline]) AND (Q2.[MinOfprice per adult] = [ticket cut rate].[price per adult]) GROUP BY [ticket cut rate].[primary airline], [ticket cut rate].[price per adult]; How can I get the same result with only one sql statement??? Oh by the way, can I create queries in MySQL just like MSAccess Please help bst rgds Hayan - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Advice for dataupload
Dear all, I have two design-identical database, one on my intranet, the other on the internet, is there any procedure that Synchronizes the content of two databases? I'm using PHP applications and MySQL Database, WindowsNT4 IIS Please advice Best Regards Hayan - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Table Field Size ..
Hi, I want to ask what difference can be between two MySQL Table CHAR fields the first one's size (In Design) is (10) and the other is (100), but the tow contains the same length of charachters like 3 charachters. Does it effect speed, data size... Please advice Best Regards Hayan - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Which is Faster
Dear all, Which of the following SQL queries is faster and better select thefield from thetable group by thetable Or select distinct thefield from thetable? and WHY? Best Regards Hayan Get your own 800 number Voicemail, fax, email, and a lot more http://www.ureach.com/reg/tag - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Table Lock
Hi, Is there a way to lock a table so that only one user can change it and then unlockit? I need to do this coz I want visitors to retrieve some values from a database but each value must be retrieved only by one user and then marked up to be expired, so I don't want two users to retrieve the same value Any suggestions Best Regards Hayan - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Table Lock
Hi, Is there a way to lock a table so that only one user can change it and then unlockit? I need to do this coz I want visitors to retrieve some values from a database but each value must be retrieved only by one user and then marked up to be expired, so I don't want two users to retrieve the same value Any suggestions Best Regards Hayan - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Problem with Load Data InFile
Dear all, I had a problem with load data infile syntax LOAD DATA INFILE '$file' REPLACE INTO TABLE $table FIELDS TERMINATED BY '|' that the original data has already carriage returns was considered as new records in the database, I solved it by using the following syntax: LOAD DATA INFILE '$file' REPLACE INTO TABLE $table FIELDS TERMINATED BY '|' LINES TERMINATED BY '^' well it worked BUT it generates a strange blank charachter at the beginning of the first field of each record is there any soloution that brings me peace of mind for such problems, concerning that I previously suffered from developing in local environment before publishing which forced me to use two different syntaxes of LOAD DATA... the first one with ADDSLASHES() function to the $file argument and the second without this funcion Please advice if you a solution - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Problem with LOAD DATA INFILE
HI ALL: Happy New Year ;) I have a text file generated from MSAccess database, one of the fields (Long Text) have Carriage returns within the text, So the data of some records falls in more than one line in the text file, when I'm using the SQL statement LOAD DATA INFILE... I have only the first line of the data in this field, You know the data in the file looks like : 8|RO|The rates are applicabe for prepaid shipments only. Other charges: Awb fees 230Syp, Handling 0.65Syp per KG, Stamp 16Syp.|\r\n 9|KL|Other charges: Awb fees 230Syp, Handling 0.65Syp per KG, Stamp 16Syp, Security Charge 0.13Usd per Kg based on actual weight of the shipment.|\r\n 10|JU|Other charges: Awb fees 230Syp, Handling 0.65Syp per KG, Stamp 16Syp.|\r\n Please Help Best Regards Hayan Get your own 800 number Voicemail, fax, email, and a lot more http://www.ureach.com/reg/tag - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php