delete help
I hope someone can help, I am a newbe as sql and need a some help I can by using this command at mysql prompt |select ACCTSESSIONID from radiuslog where ACCTSESSIONTIME='0';| get a list that I then need to delete but when I used the following I keep get errors delete from radiuslog where ACCTSESSIONID = any (select ACCTSESSIONID from radiuslog where ACCTSESSIONTIME='0'); I can not delete the record by just deleting the record with the 0 ACCTSESSIONTIME as this would only delete the Stop and not the start record with the same ACCTSESSIONID from this radiuslog http://netwinsite.com/dbabble/ -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: delete help
Are you aware that you are using a nested sql query which isn't available until version 4.1? Try splitting the delete into multiple steps 1) populate a temp table with the id's you want to delete then 2) use the temp table data to delete the rows. - Original Message - From: tech [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, December 08, 2003 3:16 AM Subject: delete help I hope someone can help, I am a newbe as sql and need a some help I can by using this command at mysql prompt |select ACCTSESSIONID from radiuslog where ACCTSESSIONTIME='0';| get a list that I then need to delete but when I used the following I keep get errors delete from radiuslog where ACCTSESSIONID = any (select ACCTSESSIONID from radiuslog where ACCTSESSIONTIME='0'); I can not delete the record by just deleting the record with the 0 ACCTSESSIONTIME as this would only delete the Stop and not the start record with the same ACCTSESSIONID from this radiuslog http://netwinsite.com/dbabble/ -- 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: delete help
Thank you for taking the time to reply I am using version 4.1 as can be seen from the out put below mysql Ver 13.5 Distrib 4.1.0-alpha, for portbld-freebsd5.1 (i386) Also I am unsure of the syntax for what you suggest Are you aware that you are using a nested sql query which isn't available until version 4.1? Try splitting the delete into multiple steps 1) populate a temp table with the id's you want to delete then 2) use the temp table data to delete the rows. - Original Message - From: tech [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, December 08, 2003 3:16 AM Subject: delete help I hope someone can help, I am a newbe as sql and need a some help I can by using this command at mysql prompt |select ACCTSESSIONID from radiuslog where ACCTSESSIONTIME='0';| get a list that I then need to delete but when I used the following I keep get errors delete from radiuslog where ACCTSESSIONID = any (select ACCTSESSIONID from radiuslog where ACCTSESSIONTIME='0'); I can not delete the record by just deleting the record with the 0 ACCTSESSIONTIME as this would only delete the Stop and not the start record with the same ACCTSESSIONID from this radiuslog http://netwinsite.com/dbabble/ -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] http://netwinsite.com/dbabble/ -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Problem with nested delete - help
On Sat, 18 Aug 2001, Ram wrote: Date: Sat, 18 Aug 2001 06:16:39 -0700 (PDT) From: Ram [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Problem with nested delete - help Hi, I have a problem with nested delete query. I want to delete some record from one table based on the select result of another query. e.g. delete from tab1 where uid in (select uid from tab2 where today = 'any_date'); Will it work? Not in the database. You will have to do this at the application level, i.e., do one query to get the uid's from tab2 and then issue separate deletes for each uid. Quite fast with prepared statements in perl. I tried, but it says that 'syntex error near 'select.' at line 1. If anybody know how to do that, ple let me know. Thanks in advance. Ram __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/ - 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 Sincerely, William Mussatto, Senior Systems Engineer CyberStrategies, Inc ph. 909-920-9154 ext. 27 - 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