Re: category with parentid
and also id (either cat or subcat) can be called - Original Message - From: "HaidarPesebe" To: "MySQL Lists" Sent: Wednesday, May 30, 2012 2:31 PM Subject: Re: category with parentid Hello ts. Tanaka, I've tried your way and succeed. Thank you. But I want to ask your help again what if the result will be like this: A. Cat A - Subcat A - Subcat A 2. CatB - Subcat B possible by using or which the previous result is Cat A - SubcatA, SubcatA Cat B - SubcatB thank you __ Information from ESET NOD32 Antivirus, version of virus signature database 7179 (20120529) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com __ Information from ESET NOD32 Antivirus, version of virus signature database 7179 (20120529) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql
Re: category with parentid
Hello ts. Tanaka, I've tried your way and succeed. Thank you. But I want to ask your help again what if the result will be like this: A. Cat A - Subcat A - Subcat A 2. CatB - Subcat B possible by using or which the previous result is Cat A - SubcatA, SubcatA Cat B - SubcatB thank you __ Information from ESET NOD32 Antivirus, version of virus signature database 7179 (20120529) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql
Re: category with parentid
Thanks for the information; I tried to call the database with something like this; select id,name from TABLE WHERE parentid='0' and a second call to the same table as this; select id,name from TABLE WHERE parentid='$id' (this $id is the result of calling the first call TABLE) and successfully. or are there other examples that simple? Thanks __ Information from ESET NOD32 Antivirus, version of virus signature database 7173 (20120527) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql
category with parentid
I have a database for the category id | name | parentid -- 1 | cat A | 0 2 | cat B | 0 3 | subcat A | 1 4 | subcat A | 1 5 | subncat B | 2 - I want to display the result like this: 1. Cat A - Subcat A - Subcat A 2. CatB - Subcat B ask for help for this. Thanks for the help __ Information from ESET NOD32 Antivirus, version of virus signature database 7165 (20120524) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com
Re: migrate existing data each additional product
Thanks for quick reply. And also thank you very much for the information. Best regard --Original Message-- From: Johan De Meersman To: Albahar Uya Cc: MySQL Lists Subject: Re: migrate existing data each additional product Sent: Apr 4, 2012 17:33 - Original Message - > From: "HaidarPesebe" > > I asked for help, how to order that each time I add an item then the > item number in column 1 move to column 2, column 2 moves to the > column 3, column 3 to 4 and so on. > > product | 1 | 2 | 3 | 4 | total > [...] What a most peculiar thing to do :-) You can't have - correction: I don't think you can have column names that start with a digit, so I'll conveniently call them c1 and so on. An update statement is processed in order, so this should work: UPDATE SET c4=c3, c3=c2, c2=c1, c1=, total=c1+c2+c3+c4 WHERE ; I would strongly question whether there's no better way to design whatever you're doing, though. /johan -- Bier met grenadyn Is als mosterd by den wyn Sy die't drinkt, is eene kwezel Hy die't drinkt, is ras een ezel Sent from my BlackBerry® smartphone
Re: results from a total of always amount to a multiple of 3
Exactly what you are saying Mr. Sándor. I tried adding a recordamount of debt then becomes a multiple of 4. Well I'm really confused. Are there any who can help? how to call the databaseby entering on the right? - Original Message - From: HaidarPesebe To: MySQL Lists Sent: Friday, July 29, 2011 10:48 AM Subject: results from a total of always amount to a multiple of 3 I experienced a unique problem, after I call the database as follows: SELECT id, concat(period,'-',semester) as periodsmester, sum(qty) as qtyone, sum(bqty) as qtytwo FROM pay a INNER JOIN debt b on (a.name=b.uname AND a.period=b.bperiod AND a.semester=b.bsemester) WHERE name='jon' group by concat(period,semester) order by period ASC, semester ASC but results from a total of always amount to a multiple of 3. should total qty (USD) pay = 8 but the result would be 24. so also for the Debt. Please help. Such databases DB 1 = pay id | name | period | semester | qty(USD) 1 | jon| 2010-2011 | 1 | 2 2 | jon| 2010-2011 | 1 | 1 3 | jon| 2010-2011 | 1 | 3 4 | jon| 2010-2011 | 1 | 2 DB 2 = Debt did | uname | bperiod| bsemester | remark | bqty(USD) - 1 | jon | 2010-2011| 1| paper| 7 2 | jon | 2010-2011| 1| mouse | 4 Thanks, Haidarpesebe __ Information from ESET NOD32 Antivirus, version of virus signature database 6333 (20110728) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com __ Information from ESET NOD32 Antivirus, version of virus signature database 6339 (20110731) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com __ Information from ESET NOD32 Antivirus, version of virus signature database 6339 (20110731) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com
results from a total of always amount to a multiple of 3
I experienced a unique problem, after I call the database as follows: SELECT id, concat(period,'-',semester) as periodsmester, sum(qty) as qtyone, sum(bqty) as qtytwo FROM pay a INNER JOIN debt b on (a.name=b.uname AND a.period=b.bperiod AND a.semester=b.bsemester) WHERE name='jon' group by concat(period,semester) order by period ASC, semester ASC but results from a total of always amount to a multiple of 3. should total qty (USD) pay = 8 but the result would be 24. so also for the Debt. Please help. Such databases DB 1 = pay id | name | period | semester | qty(USD) 1 | jon| 2010-2011 | 1 | 2 2 | jon| 2010-2011 | 1 | 1 3 | jon| 2010-2011 | 1 | 3 4 | jon| 2010-2011 | 1 | 2 DB 2 = Debt did | uname | bperiod| bsemester | remark | bqty(USD) - 1 | jon | 2010-2011| 1| paper| 7 2 | jon | 2010-2011| 1| mouse | 4 Thanks, Haidarpesebe __ Information from ESET NOD32 Antivirus, version of virus signature database 6333 (20110728) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com
Re: calculate the total amount of revenue each month-year
I've tried it and succeeded. Thanks for the help Mr. Misra. Best regards, Haidarpesebe . - Original Message - From: "Aveek Misra" To: "HaidarPesebe" Cc: "MySQL Lists" Sent: Monday, June 20, 2011 11:28 AM Subject: Re: calculate the total amount of revenue each month-year SELECT CONCAT(b.month, '-', b.year) AS Date, SUM(b.quantity * a.price) AS Total FROM items AS a, orders AS b WHERE a.code = b.code GROUP BY month, year; where "items" is "Table A" and "orders" is "Table B" Thanks Aveek On Jun 20, 2011, at 9:27 AM, HaidarPesebe wrote: Please help us calculate the total amount of revenue each month-year from the two databases below. The first database is the name of the item and price. The second database is the goods sold. I Will Make a recapitulation of every month to my total income (total only). I've always tried but failed. TABLE A (item name and price) NO : CODE : NAME : PRICE(USD) : -- 1 : A01 : NAME A : 20 2 : A02 : NAME B : 15 - TABLE B (items sold) - : NO : CODE : CITY : QTY : MONTH : YEAR : --- : 1: A01: PARIS : 20 : 1 : 2011 : : 2: A01: LONDON : 11 : 1 : 2011 : : 3: A02: PARIS : 15 : 1 : 2011 : : 4: A02: PARIS : 10 : 1 : 2011 : : 5: A01: PARIS : 7 : 2 : 2011 : : 6: A01: LONDON : 8 : 2 : 2011 : : 7: A02: LONDON : 10 : 2 : 2011 : the result will be like this NO : DATE (month year): Total (USD) --- 1 : 1 - 2011: 995 2 : 2 - 2011: 450 We have tried but does not match the sum qyt. After I check the price turns out to be called just only the price of A even for multiplication NAME A02 CODE. Over its support I thank you. Haidapesebe __ Information from ESET NOD32 Antivirus, version of virus signature database 6221 (20110619) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com __ Information from ESET NOD32 Antivirus, version of virus signature database 6221 (20110619) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com __ Information from ESET NOD32 Antivirus, version of virus signature database 6221 (20110619) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
calculate the total amount of revenue each month-year
Please help us calculate the total amount of revenue each month-year from the two databases below. The first database is the name of the item and price. The second database is the goods sold. I Will Make a recapitulation of every month to my total income (total only). I've always tried but failed. TABLE A (item name and price) NO : CODE : NAME : PRICE(USD) : -- 1 : A01 : NAME A : 20 2 : A02 : NAME B : 15 - TABLE B (items sold) - : NO : CODE : CITY : QTY : MONTH : YEAR : --- : 1: A01: PARIS : 20 : 1 : 2011 : : 2: A01: LONDON : 11 : 1 : 2011 : : 3: A02: PARIS : 15 : 1 : 2011 : : 4: A02: PARIS : 10 : 1 : 2011 : : 5: A01: PARIS : 7 : 2 : 2011 : : 6: A01: LONDON : 8 : 2 : 2011 : : 7: A02: LONDON : 10 : 2 : 2011 : the result will be like this NO : DATE (month year): Total (USD) --- 1 : 1 - 2011: 995 2 : 2 - 2011: 450 We have tried but does not match the sum qyt. After I check the price turns out to be called just only the price of A even for multiplication NAME A02 CODE. Over its support I thank you. Haidapesebe __ Information from ESET NOD32 Antivirus, version of virus signature database 6221 (20110619) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com
calculate the total revenue from the two databases
Please help calculate the total revenue from the two databases below. The first database is the name of the item and price. The second database is the goods sold. I will make a recapitulation of every month to my total income (total only). I've tried tp always failed. TABLE A (item name and price) NO : CODE : NAME : PRICE(USD) : -- 1 : A01 : NAME A : 20 2 : A02 : NAME B : 15 - TABLE B (items sold) - : NO : CODE : CITY : QTY : MONTH : YEAR : --- : 1: A01: PARIS : 20 : 1 : 2011 : : 2: A01: LONDON : 11 : 1 : 2011 : : 3: A02: PARIS : 15 : 1 : 2011 : : 4: A02: PARIS : 10 : 1 : 2011 : : 5: A01: PARIS : 7 : 2 : 2011 : : 6: A01: LONDON : 8 : 2 : 2011 : : 7: A02: LONDON : 10 : 2 : 2011 : the result will be like this NO : DATE (month year): Total (USD) --- 1 : 1 - 2011: 995 2 : 2 - 2011: 450 Best regards, Haidar __ Information from ESET NOD32 Antivirus, version of virus signature database 6215 (20110616) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com
Re: call the data if more than one id
Thanks a lot. - Original Message - From: Claudio Nanni To: HaidarPesebe Cc: MySQL Lists Sent: Tuesday, April 12, 2011 12:55 PM Subject: Re: call the data if more than one id In (2,3,4) On Apr 12, 2011 7:53 AM, "HaidarPesebe" wrote: > please help me how to call the data if more than one id. Eg SELECT * FROM news WHERE id = 2, 3 and 4 > > Thanks. > > > __ Information from ESET NOD32 Antivirus, version of virus signature database 6034 (20110411) __ > > The message was checked by ESET NOD32 Antivirus. > > http://www.eset.com > __ Information from ESET NOD32 Antivirus, version of virus signature database 6034 (20110411) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com
call the data if more than one id
please help me how to call the data if more than one id. Eg SELECT * FROM news WHERE id = 2, 3 and 4 Thanks. __ Information from ESET NOD32 Antivirus, version of virus signature database 6034 (20110411) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com
Re: backfill results for the same month and year
I've tried it and succeeded. thanks mark - Original Message - From: HaidarPesebe To: MySQL Lists Sent: Thursday, November 11, 2010 4:00 PM Subject: backfill results for the same month and year Dear All, I have the following data ID CITY QTY MONTH YEAR --- 1 Chigago10 11 2010 1 NewYork 22 11 2010 1 London 54 11 2010 1 Chigago7 10 2010 1 NewYork 26 10 2010 1 London 33 10 2010 ID = ID PRODUCT. How can I backfill results with the same ID by month and year, with results like this: MONTH/YEARQTY TOTAL --- 11/201086 10/201066 and etc. Please help Thanks haidarpesebe
backfill results for the same month and year
Dear All, I have the following data ID CITY QTY MONTH YEAR --- 1 Chigago10 11 2010 1 NewYork 22 11 2010 1 London 54 11 2010 1 Chigago7 10 2010 1 NewYork 26 10 2010 1 London 33 10 2010 ID = ID PRODUCT. How can I backfill results with the same ID by month and year, with results like this: MONTH/YEARQTY TOTAL --- 11/201086 10/201066 and etc. Please help Thanks haidarpesebe
Re: select data from two tables and SUM qty of the same ID
I tried this and succeeded. Thank you SELECT product_id, isbn, name, author, harga, discount, sum(qty) as totalqty FROM " . $prefix . "_sales_report b INNER JOIN " . $prefix . "_product p ON (p.product_id = b.bid) GROUP BY b.bid ORDER BY totalqty DESC haidarpesebe - Original Message - From: "Aveek Misra" To: "HaidarPesebe" Cc: "MySQL Lists" Sent: Wednesday, November 10, 2010 5:38 PM Subject: Re: select data from two tables and SUM qty of the same ID SELECT product.ID, product.ProductName, product.ISBN, SUM(salesreport.QTY) as Total_Quantity FROM salesreport, product WHERE product.ID = salesreport.ID GROUP BY salesreport.ID ORDER BY Total_Quantity DESC; On Nov 10, 2010, at 3:53 PM, HaidarPesebe wrote: please help us look for the data select from two tables with the following details: Primary table: product ID | ProductName | ISBN | --- 1 | Product A | 123 | 2 | Product B | 456 | 3 | product C | 444 | --- second table: salesreport IDS | ID | CITY | QTY | 1| 1 | New York | 3 | 2| 1 | Alabama | 5 | 3| 1 | London| 1 | 4| 1 | Jakarta| 5 | 5| 2 | New York | 8 | 6| 2 | Alabama | 4 | 7| 2 | London| 9 | 8| 2 | Jakarta| 3 | -- ID in table product same with ID table salesreport How we will show SALES REPORT product is sold only at the table salesreport SUM qty to the top sold and unsold product C will not be displayed. The result will be like this: No. Product Name ISBN QTY 1. product B 45624 2. product A 12314 I'm using PHP. Thanks a lot for information. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
Re: select data from two tables and SUM qty of the same ID
we've tried to use as your dialing purposes, but still can not. This structure SELECT product.product_id, product.isbn, product.name, product.author, product.harga, product.discount, sum(sales_report.qty) as totalqty FROM " . $prefix . "_sales_report, " . $prefix . "_product WHERE product.product_id = sales_report.bid GROUP BY sales_report.bid ORDER BY totalqty DESC Display error on the screen like this: Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in E:\xampp\htdocs\test\inc\sqllayer.php on line 271 Unknown column 'product.product_id' in 'field list' Note: product_id (product) = bid (sales_report) haidarpesebe - Original Message - From: "Aveek Misra" To: "HaidarPesebe" Cc: "MySQL Lists" Sent: Wednesday, November 10, 2010 5:38 PM Subject: Re: select data from two tables and SUM qty of the same ID SELECT product.ID, product.ProductName, product.ISBN, SUM(salesreport.QTY) as Total_Quantity FROM salesreport, product WHERE product.ID = salesreport.ID GROUP BY salesreport.ID ORDER BY Total_Quantity DESC; On Nov 10, 2010, at 3:53 PM, HaidarPesebe wrote: please help us look for the data select from two tables with the following details: Primary table: product ID | ProductName | ISBN | --- 1 | Product A | 123 | 2 | Product B | 456 | 3 | product C | 444 | --- second table: salesreport IDS | ID | CITY | QTY | 1| 1 | New York | 3 | 2| 1 | Alabama | 5 | 3| 1 | London| 1 | 4| 1 | Jakarta| 5 | 5| 2 | New York | 8 | 6| 2 | Alabama | 4 | 7| 2 | London| 9 | 8| 2 | Jakarta| 3 | -- ID in table product same with ID table salesreport How we will show SALES REPORT product is sold only at the table salesreport SUM qty to the top sold and unsold product C will not be displayed. The result will be like this: No. Product Name ISBN QTY 1. product B 45624 2. product A 12314 I'm using PHP. Thanks a lot for information. __ Information from ESET Smart Security, version of virus signature database 5608 (20101110) __ The message was checked by ESET Smart Security. http://www.eset.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
select data from two tables and SUM qty of the same ID
please help us look for the data select from two tables with the following details: Primary table: product ID | ProductName | ISBN | --- 1 | Product A | 123 | 2 | Product B | 456 | 3 | product C | 444 | --- second table: salesreport IDS | ID | CITY | QTY | 1| 1 | New York | 3 | 2| 1 | Alabama | 5 | 3| 1 | London| 1 | 4| 1 | Jakarta| 5 | 5| 2 | New York | 8 | 6| 2 | Alabama | 4 | 7| 2 | London| 9 | 8| 2 | Jakarta| 3 | -- ID in table product same with ID table salesreport How we will show SALES REPORT product is sold only at the table salesreport SUM qty to the top sold and unsold product C will not be displayed. The result will be like this: No. Product Name ISBN QTY 1. product B 45624 2. product A 12314 I'm using PHP. Thanks a lot for information.
Re: select data from two tables and SUM qty of the same ID
Thanks a lot. We will try and inform you. --Original Message-- From: Aveek Misra To: Albahar Uya Cc: MySQL Lists Subject: Re: select data from two tables and SUM qty of the same ID Sent: Nov 10, 2010 17:38 SELECT product.ID, product.ProductName, product.ISBN, SUM(salesreport.QTY) as Total_Quantity FROM salesreport, product WHERE product.ID = salesreport.ID GROUP BY salesreport.ID ORDER BY Total_Quantity DESC; On Nov 10, 2010, at 3:53 PM, HaidarPesebe wrote: > please help us look for the data select from two tables with the following > details: > > Primary table: product > ID | ProductName | ISBN | > --- > 1 | Product A | 123 | > 2 | Product B | 456 | > 3 | product C | 444 | > --- > > second table: salesreport > IDS | ID | CITY | QTY | > > 1| 1 | New York | 3 | > 2| 1 | Alabama | 5 | > 3| 1 | London| 1 | > 4| 1 | Jakarta| 5 | > 5| 2 | New York | 8 | > 6| 2 | Alabama | 4 | > 7| 2 | London| 9 | > 8| 2 | Jakarta| 3 | > -- > > ID in table product same with ID table salesreport > How we will show SALES REPORT product is sold only at the table salesreport > SUM qty to the top sold and unsold product C will not be displayed. > > The result will be like this: > > No. Product Name ISBN QTY > > 1. product B 45624 > 2. product A 12314 > > > I'm using PHP. Thanks a lot for information. Sent from my BlackBerry®
Re: from excel to the mySQL
Thanks for your information, we have tried it and solve my problems. Thanks. - Original Message - From: Miguel Vaz To: HaidarPesebe Cc: MySQL Lists Sent: Wednesday, August 04, 2010 1:40 AM Subject: Re: from excel to the mySQL Hi, Ive always used navicat for mysql and it does wonders for import/export (wether it be from excel or any other file type) and also general database management. Actually, too many features to list here, check the website: http://www.navicat.com/en/products/navicat_mysql/mysql_overview.html Pag On Tue, Aug 3, 2010 at 10:23 AM, HaidarPesebe wrote: Dear All, I'm needs a way to upload data from excel to the mySQL database. Dear all, I need help is how to upload data from excel columns and load into mysql database using php? Thanks HaidarPesebe
Re: from excel to the mySQL
Thanks for your information, we are sorry about this. - Original Message - From: Martin Gainty To: pagong...@gmail.com ; haidarpes...@gmail.com Cc: mysql@lists.mysql.com Sent: Wednesday, August 04, 2010 6:20 AM Subject: RE: from excel to the mySQL Vaz please do not insert bogus display names into the email display name (such as Vaz when your real name is haidarpesebe) most responsible mail-admins wont tolerate this type of spoofing or any type of email spoofing and if your name is VAZ use the email address created for VAZ instead of haidarpesebe Martin __ Verzicht und Vertraulichkeitanmerkung Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. > Date: Tue, 3 Aug 2010 19:40:58 +0100 > Subject: Re: from excel to the mySQL > From: pagong...@gmail.com > To: haidarpes...@gmail.com > CC: mysql@lists.mysql.com > > Hi, > > Ive always used navicat for mysql and it does wonders for import/export > (wether it be from excel or any other file type) and also general database > management. Actually, too many features to list here, check the website: > > http://www.navicat.com/en/products/navicat_mysql/mysql_overview.html > > > > > Pag > > > On Tue, Aug 3, 2010 at 10:23 AM, HaidarPesebe wrote: > > > Dear All, > > I'm needs a way to upload data from excel to the mySQL database. Dear all, > > I need help is how to upload data from excel columns and load into mysql > > database using php? > > Thanks > > HaidarPesebe __ Information from ESET Smart Security, version of virus signature database 5338 (20100803) __ The message was checked by ESET Smart Security. http://www.eset.com
from excel to the mySQL
Dear All, I'm needs a way to upload data from excel to the mySQL database. Dear all, I need help is how to upload data from excel columns and load into mysql database using php? Thanks HaidarPesebe
Re: Most data sort
Dear Mr. Wang, I've tried and the results are in accordance with the intended. Your description is very brief and precise Thank you Mr. Wang. With best regard, Haidar Pesebe - Original Message - From: "HaidarPesebe" To: "Yang Wang" ; "MySQL Lists" Sent: Monday, December 21, 2009 5:29 PM Subject: Re: Most data sort Thanks Mr. Wang, I will try and inform you again if have a problem. Best regard, Haidar Pesebe - Original Message - From: "Yang Wang" To: "HaidarPesebe" ; "MySQL Lists" Sent: Monday, December 21, 2009 5:22 PM Subject: Re: Most data sort sample as below with group by and order by statment mysql> create table t2(name char(1),qty smallint); Query OK, 0 rows affected (0.01 sec) mysql> insert into t2 values('A',1),('B',2),('A',4),('A',1),('A',1),('B',1),('A',2),('C',2),('D',1),('C',4); Query OK, 10 rows affected (0.00 sec) Records: 10 Duplicates: 0 Warnings: 0 mysql> select * from t2; +--+--+ | name | qty | +--+--+ | A|1 | | B|2 | | A|4 | | A|1 | | A|1 | | B|1 | | A|2 | | C|2 | | D|1 | | C|4 | +--+--+ 10 rows in set (0.00 sec) mysql> select name,sum(qty) as qty from t2 group by name order by qty desc; +--+--+ | name | qty | +--+------+ | A|9 | | C|6 | | B|3 | | D|1 | +--+--+ 4 rows in set (0.01 sec) Best Regards! Yang Wang - Original Message - From: "HaidarPesebe" To: "MySQL Lists" Sent: Monday, December 21, 2009 3:31 PM Subject: Most data sort Dear All, I need your help to how to call the database. I've got a mysql database as follows: -- Name | qty - A 1 B 2 A 4 A 1 B 1 A 2 C 2 D 1 C 4 How calling if I want to sort the data according to the most, or the result will look like this A = 7 C = 6 B = 3 D = 1 Thanks a lot Haidarpesebe __ Information from ESET Smart Security, version of virus signature database 4704 (20091220) __ The message was checked by ESET Smart Security. http://www.eset.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
Re: Most data sort
Thanks Mr. Wang, I will try and inform you again if have a problem. Best regard, Haidar Pesebe - Original Message - From: "Yang Wang" To: "HaidarPesebe" ; "MySQL Lists" Sent: Monday, December 21, 2009 5:22 PM Subject: Re: Most data sort sample as below with group by and order by statment mysql> create table t2(name char(1),qty smallint); Query OK, 0 rows affected (0.01 sec) mysql> insert into t2 values('A',1),('B',2),('A',4),('A',1),('A',1),('B',1),('A',2),('C',2),('D',1),('C',4); Query OK, 10 rows affected (0.00 sec) Records: 10 Duplicates: 0 Warnings: 0 mysql> select * from t2; +--+--+ | name | qty | +--+--+ | A|1 | | B|2 | | A|4 | | A|1 | | A|1 | | B|1 | | A|2 | | C|2 | | D|1 | | C|4 | +--+--+ 10 rows in set (0.00 sec) mysql> select name,sum(qty) as qty from t2 group by name order by qty desc; +--+--+ | name | qty | +--+--+ | A|9 | | C|6 | | B| 3 | | D|1 | +--+--+ 4 rows in set (0.01 sec) Best Regards! Yang Wang - Original Message - From: "HaidarPesebe" To: "MySQL Lists" Sent: Monday, December 21, 2009 3:31 PM Subject: Most data sort Dear All, I need your help to how to call the database. I've got a mysql database as follows: -- Name | qty - A 1 B 2 A 4 A 1 B 1 A 2 C 2 D 1 C 4 How calling if I want to sort the data according to the most, or the result will look like this A = 7 C = 6 B = 3 D = 1 Thanks a lot Haidarpesebe -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
Most data sort
Dear All, I need your help to how to call the database. I've got a mysql database as follows: -- Name | qty - A 1 B 2 A 4 A 1 B 1 A 2 C 2 D 1 C 4 How calling if I want to sort the data according to the most, or the result will look like this A = 7 C = 6 B = 3 D = 1 Thanks a lot Haidarpesebe
select data from two table and will sort by price in second table
dear all, please help us mien for select data from two table with details as follows: primery tabel : bookcatalog second table : pricelist for seaching we will try to sort by price (in second table). our databese details like this: SELECT id, title, author from bookcatalog where isbn LIKE '%$query%' or title LIKE '%$query%' or author LIKE '%$query%' for information id in bookcatalog and pricelist are same. thanks a lot Haidarpesebe