0

Good afternoon,

currently I am trying to remove a row from my database if the value does not exist in my variable. I am calling a variable $blsrowP["field_zipcode_value"] which returns all zipcodes from our database. Another database holds these same zipcodes. I want to compare these zipcodes from my variable with the new database and remove the zipcodes that are not listed inside this variable.

I am not comparing two different databases, but just the variable with my database. I tried searching online but I can only find comparing two different database tables. Thanks.

1 Answer 1

1

If you can pass the variables in a not in query you can achieve this (if I understood correctly). Develop the below query in your program/script and get the list from the first database and delete it from the second database.

Delete * from tabname where column not in (<provide your variable list>)

If it won't help please provide more details.

Sign up to request clarification or add additional context in comments.

1 Comment

Awesome, it works perfect. The code it turned out to be is $update100 = 'Delete * from creat_companies_zip_lat_long where field_zipcode_value not in (' . $blsrowP["field_zipcode_value"] . ')'; After executing this one all rows where the zipcode is not present in variable are deleted. Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.