Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

is it possible to delete record from sql

 
john mattucci
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Im new to most of this ,so please bare with me. I have a table
with email addresses. And I would like to delete a record if it
is no longer in use. How would I write this would it be something like this "DELETE [Email Address] FROM [Email Addresses] WHERE
[Email Address] LIKE '" + emailString + "'";
Thank u for your time
 
Daniel Dunleavy
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Almost
delete from email_addresses where email_address = 'xxxx'
Use = if you can instead of like.
Dan
 
Pranit Saha
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
int rowsAffected = stat.executeUpdate("delete from emailaddres where userid = " + emailstring);
Assuming that stat is the Statement Object and emailstring stores that emailid what u want to delete..
Thanks..
 
Jamie Robertson
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Pranit Saha:
int rowsAffected = stat.executeUpdate("delete from emailaddres where userid = " + emailstring);
Assuming that stat is the Statement Object and emailstring stores that emailid what u want to delete..
Thanks..

you mean:
int rowsAffected = stat.executeUpdate("delete from emailaddres where userid = '" + emailstring + "'");
right?
Jamie
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic