>>> Inandjo <<<<
- delete from table1 where table1.field1 in (select distinct field2 from
table2)
<<<<<<<<<<<<<<<<<<<<<

>From what I've read subqueries are not yet supported.   We worked around
this by converting the distinct list to a comma delimited list of
values. E.g.,

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::

*- Create a delimited list of field1 from table1
lcDelimitedList = goQCApp.p_oFunc.m_CreateList("table1","field1")

*- Build our query string
sqlString = "Delete from table1 where table.field1 in (" +
lcDelimitedList + ")"

*- Execute query string
If !goQCApp.m_SqlExec(sqlString)
        return messagebox("Rutt, row.... Query Failed
=>"+sqlString",16,"ABORTED")=6
endif

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::

Note that where MySql is happy with both double and single quotes (for
strings), Microsoft Sql Server chokes on double quotes; we found it best
to use single quotes.

We're in the midst of our conversion (from Visual Foxpro to MySql/Sql
backend) and have not yet seen a limitation in using this approach.

- Bill K.


>-----Original Message-----
>From: Inandjo Taurel [mailto:[EMAIL PROTECTED]] 
>Sent: Monday, February 17, 2003 8:35 AM
>To: [EMAIL PROTECTED]
>Subject: How to write delete query??
>
>
>SQL SQL
>hi all,
>i have a query that works just fine on Dbase, but just crashes 
>on mysql.
>How can i write it in one statement for it to work both on 
>Dbase and mysql?
>
>
>the query:
>- delete from table1 where table1.field1 in (select distinct 
>.
>
>Thanx
>
>
>_________________________________________________________________
>MSN 8 with e-mail virus protection service: 2 months FREE* 
>http://join.msn.com/?page=features/virus
>
>
>---------------------------------------------------------------------
>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
>
>


---------------------------------------------------------------------
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

Reply via email to