Forum Moderators: open

Message Too Old, No Replies

Need to Search & Export Only Certain Records

to edit and create a new slightly different database

         

old_expat

1:12 pm on Aug 3, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have a database of about 1,000 properties where one field is "beaches".

I want to create another database, for a different site, that has only those properties which has some value in "beaches", around 300-400 of them.

The reason I can't use the existing database is because another field, "description", needs to be reformatted for the new application.

I can wade through "_properties.sql" and make the changes, but I only want to use the pertinent records.

I'm wondering if there is a way to search on "beaches"=NOT NULL .. or something like that, and then export only those results in an *.sql format.

volatilegx

2:05 pm on Aug 5, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'd think the easy way to do this would be to do a data dump (make a backup maybe) of the whole database, recreate it, then run this query

DELETE FROM 'TABLENAME' WHERE 'beaches' = '';

Then, you could change the properties of the 'description' field. I don't know exactly what type of database you are talking about. The above query will work on MySQL.

old_expat

3:56 am on Aug 6, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi volatilegx,

I did lots of scrambling around in the few days after putting up this message.

What I ended up trying is using PHPMyadmin and doing a search on 'beaches' using 'REGEX' and '[a-z]'

That showed all the records, so then I exported those as *.sql and edited those for my new database.

Thanks for the tip. Only thing, I get REALLY nervous around anything that says 'delete'.;)