assume I have a table containing the following fields:
- airline
- flight number
- from
- to
sample entries maybe:
LH | 1 | london | new york
LH | 2 | chicago| toronto
AA | 1 | miami | vancouver
AA | 2 | LA | Seatle
I want to delete all entries for airlines that have flight leaving from london (i.e. in our example that would be just LH), the current way is using one select statment to get a list of all airlines that fit the criteria then go through the list (loop) and for each issue a DELETE statment. this makes it a bit slow since your hitting the database multiple times. I tried Delete where airline in (select ....) but it won't let me saying that the nested select must be accessing another table.
Question
Dark2020
Hi all,
assume I have a table containing the following fields:
- airline
- flight number
- from
- to
sample entries maybe:
LH | 1 | london | new york
LH | 2 | chicago| toronto
AA | 1 | miami | vancouver
AA | 2 | LA | Seatle
I want to delete all entries for airlines that have flight leaving from london (i.e. in our example that would be just LH), the current way is using one select statment to get a list of all airlines that fit the criteria then go through the list (loop) and for each issue a DELETE statment. this makes it a bit slow since your hitting the database multiple times. I tried Delete where airline in (select ....) but it won't let me saying that the nested select must be accessing another table.
Anybody has any ideas.
thanks,
Link to comment
Share on other sites
4 answers to this question
Recommended Posts