how can i execute batch sql in one times?

Posted on 2005-05-13
Last Modified: 2008-03-10
   i want do it:

  String sql="delete from TParameterMedicareChild where parid=6;";
  sql=sql+"delete from TParameterMedicare where parId=6;";

but this code is error,how can i do it?

i use mysql5.0.
Question by:hgbdelphi

    Author Comment

    i want this can be execute in one times!

    Strin s="start TransAction;delete from TParameterMedicareChild where parid=?;delete from TParameterMedicare where parid=?;commit;"


    but this will error!

    how can i do it!

    LVL 20

    Accepted Solution


    you can delete across multiple tables in one query.

    delete TParameterMedicareChild, TParameterMedicare FROM TParameterMedicareChild, TParameterMedicare WHERE TParameterMedicare.parId = 6 AND TParameterMedicare.parId = TParameterMedicareChild.parId
    LVL 16

    Expert Comment

    i take it your using php or some scripting language??

    try this if using php...


    $host = "";
    $user = "x";
    $password = "x";
    $database = "x";

    mysql_connect($host, $user, $password) or die(mysql_error());
    mysql_select_db($database) or die(mysql_error());

    mysql_query("DELETE FROM TParameterMedicareChild WHERE parid = 6;")
    mysql_query("DELETE FROM TParameterMedicare WHERE parid = 6;")


    Ellandrd ;-)

    Author Comment

    thank,now i use java batch code.

    Featured Post

    Gigs: Get Your Project Delivered by an Expert

    Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

    Join & Write a Comment

    Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
    Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now