Thursday, March 22, 2012

Delete

Can somebody help me with a query.
carLogin is the id of the trader.
carReference is unique for the trader
Exemple:
data in my database
099 - A
099 - B
100 - A
100 - B
100 - C
100 - D
100 - E
100 - F
100 - G
100 - H
100 - I
108 - A
108 - B
Now i want delete for 1 trader (100) all the record who are not in the list
below.
ok(0)="A"
ok(1)="B"
c must be deleted
ok(2)="D"
ok(3)="E"
ok(4)="F"
g must be deleted
h must be deleted
ok(5)="I"
With other words, all the references in the list ok() must be in the
database, all the other be deleted.
Can i do this i one query.
Thx. Grard.Hi
Can you post DDL+ sample data + expected result?
"Grard Leclercq" <gerard.leclercq@.pas-de-mail.fr> wrote in message
news:m_q5f.26913$ny5.1137796@.phobos.telenet-ops.be...
> Can somebody help me with a query.
> carLogin is the id of the trader.
> carReference is unique for the trader
> Exemple:
> data in my database
> 099 - A
> 099 - B
> 100 - A
> 100 - B
> 100 - C
> 100 - D
> 100 - E
> 100 - F
> 100 - G
> 100 - H
> 100 - I
> 108 - A
> 108 - B
>
> Now i want delete for 1 trader (100) all the record who are not in the
> list
> below.
> ok(0)="A"
> ok(1)="B"
> c must be deleted
> ok(2)="D"
> ok(3)="E"
> ok(4)="F"
> g must be deleted
> h must be deleted
> ok(5)="I"
> With other words, all the references in the list ok() must be in the
> database, all the other be deleted.
> Can i do this i one query.
> Thx. Grard.
>
>
>
>
>sql

No comments:

Post a Comment