How select all records exact x days ago ?
Hi How can I get all records exact 5 days ago from a table, neither 6 days nor 4 days ? Could you give me an example ? Thanks -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
Re: How select all records exact x days ago ?
Depends on how your table is set up (you're going to need a date in the data...) but probably something along the lines of where createDate = date_sub(now(), interval 5 days). - Original Message - From: yavuz maslak mas...@ihlas.net.tr To: mysql@lists.mysql.com Sent: Sunday, 31 July, 2011 11:46:14 AM Subject: How select all records exact x days ago ? Hi How can I get all records exact 5 days ago from a table, neither 6 days nor 4 days ? Could you give me an example ? Thanks -- Bier met grenadyn Is als mosterd by den wyn Sy die't drinkt, is eene kwezel Hy die't drinkt, is ras een ezel -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
granting file privileges
I have both a theory question and a question on implementation of privileges. First theory. I have been using: grant all privileges on db-name.* to user@localhost identified by 'password'; Because I blunder about as root I never was impacted by 'file' being a global permission. As 'load infile' seems (to me) to be equivalant to 'insert' I do not see the reason for this. If its just a historical thing, so be it, but IMO it makes little sense that a user could create and/or delete a table but to import data he is required to convert a csv file to 'insert value' statements. My implementation question is about specifying the user. Apparently the following are different: 1) user@localhost 2) 'user@localhost' 3) 'user'@'localhost' I have not tested all this, but I did grant file privileges to #1 but could not use them logging into with 'mysql -u doug@localhost sysadmin' ('doug' being setup without a password). The question is which form should be used and why are they different as all are accepted without error and all add entries for the users and db tables. _ Douglas Denault http://www.safeport.com d...@safeport.com Voice: 301-217-9220 Fax: 301-217-9277 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
RE: How select all records exact x days ago ?
I don't want all records during 5 days ( 24*5days ) . Only I need records at 5 days ago ( for instance 24 hours on 26 th July 2011) ? How can I do that ? Depends on how your table is set up (you're going to need a date in the data...) but probably something along the lines of where createDate = date_sub(now(), interval 5 days). Hi How can I get all records exact 5 days ago from a table, neither 6 days nor 4 days ? Could you give me an example ? Thanks -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=mas...@ihlas.net.tr -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
Re: How select all records exact x days ago ?
mysql select day(now())-5; +--+ | day(now())-5 | +--+ | 26 | +--+ 2011/7/31 yavuz maslak mas...@ihlas.net.tr: I don't want all records during 5 days ( 24*5days ) . Only I need records at 5 days ago ( for instance 24 hours on 26 th July 2011) ? How can I do that ? Depends on how your table is set up (you're going to need a date in the data...) but probably something along the lines of where createDate = date_sub(now(), interval 5 days). Hi How can I get all records exact 5 days ago from a table, neither 6 days nor 4 days ? Could you give me an example ? Thanks -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql?unsub=mas...@ihlas.net.tr -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql?unsub=ag4ve...@gmail.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: granting file privileges
Hi Doug, 1.FILE is GLOBAL because it refers to the ability of the user to read/write files on the server host filesystem (where the filesystem permissions allow). 2. 1) user@localhost OK, not recommended 2) 'user@localhost' WRONG 3) 'user'@'localhost' OK, BEST single quotes prevent any problem in case of special characters in the host name. Cheers! Claudio 2011/7/31 d...@safeport.com I have both a theory question and a question on implementation of privileges. First theory. I have been using: grant all privileges on db-name.* to user@localhost identified by 'password'; Because I blunder about as root I never was impacted by 'file' being a global permission. As 'load infile' seems (to me) to be equivalant to 'insert' I do not see the reason for this. If its just a historical thing, so be it, but IMO it makes little sense that a user could create and/or delete a table but to import data he is required to convert a csv file to 'insert value' statements. My implementation question is about specifying the user. Apparently the following are different: 1) user@localhost 2) 'user@localhost' 3) 'user'@'localhost' I have not tested all this, but I did grant file privileges to #1 but could not use them logging into with 'mysql -u doug@localhost sysadmin' ('doug' being setup without a password). The question is which form should be used and why are they different as all are accepted without error and all add entries for the users and db tables. _ Douglas Denault http://www.safeport.com d...@safeport.com Voice: 301-217-9220 Fax: 301-217-9277 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?** unsub=claudio.na...@gmail.comhttp://lists.mysql.com/mysql?unsub=claudio.na...@gmail.com -- Claudio
Re: granting file privileges
Got it - thank you, I did not think about the meaning of file except as it relates to MySQL. Re syntax - thanks. On Sun, 31 Jul 2011, Claudio Nanni wrote: Hi Doug, 1.FILE is GLOBAL because it refers to the ability of the user to read/write files on the server host filesystem (where the filesystem permissions allow). 2. 1) user@localhost OK, not recommended 2) 'user@localhost' WRONG 3) 'user'@'localhost' OK, BEST single quotes prevent any problem in case of special characters in the host name. Cheers! Claudio 2011/7/31 d...@safeport.com I have both a theory question and a question on implementation of privileges. First theory. I have been using: grant all privileges on db-name.* to user@localhost identified by 'password'; Because I blunder about as root I never was impacted by 'file' being a global permission. As 'load infile' seems (to me) to be equivalant to 'insert' I do not see the reason for this. If its just a historical thing, so be it, but IMO it makes little sense that a user could create and/or delete a table but to import data he is required to convert a csv file to 'insert value' statements. My implementation question is about specifying the user. Apparently the following are different: 1) user@localhost 2) 'user@localhost' 3) 'user'@'localhost' I have not tested all this, but I did grant file privileges to #1 but could not use them logging into with 'mysql -u doug@localhost sysadmin' ('doug' being setup without a password). The question is which form should be used and why are they different as all are accepted without error and all add entries for the users and db tables. _ Douglas Denault http://www.safeport.com d...@safeport.com Voice: 301-217-9220 Fax: 301-217-9277 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?** unsub=claudio.na...@gmail.comhttp://lists.mysql.com/mysql?unsub=claudio.na...@gmail.com -- Claudio _ Douglas Denault http://www.safeport.com d...@safeport.com Voice: 301-217-9220 Fax: 301-217-9277 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
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