mysqldump with multiple where conditions

I'm Trying to do a mysqldump with multiple where conditions:

mysqldump -h myhost --user=myuser --password=mypass --no-create-info --opt where="sDate<2007-10-10 OR cDate>2008-09-30 OR pDate<2008-10-10" MyDB ProposedTo |sed -e \"s|INSERT INTO|REPLACE INTO|\" 2>&1 > proposeto-replace.sql
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Julian ParkerSenior Systems AdministratorCommented:
A. It's all gone very well and I just wanted a chat [ ]
B. Oh dear, it doesnt work and this is what happens.... [ ]
C. It's the weekend and I'm about to go home [ ]

   tick as appropriate
SaltyDawgAuthor Commented:
So you saying this should be correct?
UmeshSenior Principal Technical Support EngineerCommented:
Pls try this..
mysqldump -hmyhost --user=myuser --password=mypass --no-create-info --opt --where="sDate < \"2007-10-10\" OR cDate > \"2008-09-30\" OR pDate  < \"2008-10-10\"" MyDB --tables ProposedTo |sed -e \"s|INSERT INTO|REPLACE INTO|\" 2>&1 > proposeto_replace.sql

Open in new window

Active Protection takes the fight to cryptojacking

While there were several headline-grabbing ransomware attacks during in 2017, another big threat started appearing at the same time that didn’t get the same coverage – illicit cryptomining.

Julian ParkerSenior Systems AdministratorCommented:
I'm saying you've not told us what you were trying to achieve and if it was a problem.

More like a statement than a question, if you like...
SaltyDawgAuthor Commented:

I apologize but I thought it was pretty obvious.

"I'm Trying to do a mysqldump with multiple where conditions:" and  I've shown the code I used. I assumed it was understand that what I have so far is not working, because why would I post code that was already working. Trust me, and no offense, but I would not waste my time posting a question just for idle chat.
UmeshSenior Principal Technical Support EngineerCommented:
Did you check which I posted??
SaltyDawgAuthor Commented:
Yes I checked it. I think I see where my issue lies.

The posted I submitted was only a few conditions. But what I am actually looking to do is create a list of conditions into the where.

Basically I may have:

IndexNumber = 50013157000000 OR IndexNumber = 50013171000000

over 100 times.

I was retrieving a list of indexnumbers then creating the where condition based on it.

I actually have something like this:

mysqldump -h myhost --user=mypass --password=mypass --no-create-info --opt --where="IndexNumber='50013157000000' OR IndexNumber='50013171000000' OR IndexNumber='50013169000000' OR IndexNumber='50008262040000' OR IndexNumber='50010968010200' OR IndexNumber='50013013000000' OR IndexNumber='50012269010000' OR IndexNumber='50012265010000' OR IndexNumber='50012925010000' OR IndexNumber='50013140000100' OR IndexNumber='50012994010000' OR IndexNumber='50013097030000' OR IndexNumber='50012630000100' OR IndexNumber='50013159000000' OR IndexNumber='50009794000001' OR IndexNumber='50013097020000' OR IndexNumber='50006328020001' OR IndexNumber='50013153010000' OR IndexNumber='50009668060000' OR IndexNumber='50011104010000' OR IndexNumber='50008521050000' OR IndexNumber='50012919000000' OR IndexNumber='50012939000000' OR IndexNumber='50013162000000' OR IndexNumber='50013165000000' OR IndexNumber='50012938000000' OR IndexNumber='50013106000000' OR IndexNumber='50013119000000' OR IndexNumber='50012616010000' OR IndexNumber='50012023030000' OR IndexNumber='50013149000000' OR IndexNumber='50007324020000' OR IndexNumber='50012705000002' OR IndexNumber='50011718000004' OR IndexNumber='50005495030001' OR IndexNumber='50013144000000' OR IndexNumber='50002722110000' OR IndexNumber='50009062020000' OR IndexNumber='50013181000000' OR IndexNumber='50009805010000' OR IndexNumber='50011772010000' OR IndexNumber='50013183000000' OR IndexNumber='50013182000000' OR IndexNumber='50000997011600' OR IndexNumber='50009796040100' OR IndexNumber='50010041160000' OR IndexNumber='50009614030000' OR IndexNumber='50010533000001' OR IndexNumber='50009614040000' OR IndexNumber='50008836020000' OR IndexNumber='50012850020000' OR IndexNumber='50008057000100' OR IndexNumber='50013121000000' OR IndexNumber='50011951020100' OR IndexNumber='50010250030000' OR IndexNumber='50013142000000' OR IndexNumber='50012960010000' OR IndexNumber='50012957000000' OR IndexNumber='50012070010000' OR IndexNumber='50013145000000' OR IndexNumber='50013145010000' OR IndexNumber='50012961000000' OR IndexNumber='50013047000000' OR IndexNumber='50005086040200' OR IndexNumber='50013175000000' OR IndexNumber='50002093070100' OR IndexNumber='50007776090000' OR IndexNumber='50013179000000' OR IndexNumber='50013173000000' OR IndexNumber='50013154000000' OR IndexNumber='50009795010400' OR IndexNumber='50009319010000' OR IndexNumber='50012850030000' OR IndexNumber='50013118000000' OR IndexNumber='50013122000000' OR IndexNumber='50004968010000' OR IndexNumber='50009302020000' OR IndexNumber='50013137000000' OR IndexNumber='50013136000000' OR IndexNumber='50013141000000' OR IndexNumber='50008637050000' OR IndexNumber='50011421010000' OR IndexNumber='50013146000000' OR IndexNumber='50013148000000' OR IndexNumber='50013152000000' OR IndexNumber='50011663020000' OR IndexNumber='50003777030000' OR IndexNumber='50003259060000' OR IndexNumber='50012967000000' OR IndexNumber='50003259030100' OR IndexNumber='50003146000001' OR IndexNumber='50012964000100' OR IndexNumber='50013184000000' OR IndexNumber='50012942000000' OR IndexNumber='50011639010000' OR IndexNumber='50013178000000' OR IndexNumber='50006418040001' OR IndexNumber='50012917000000' OR IndexNumber='50012030020000' OR IndexNumber='50012885010000' OR IndexNumber='50013158000000' OR IndexNumber='50013153000000' OR IndexNumber='50010423010000' OR IndexNumber='50003090020000' OR IndexNumber='50013185000000' OR IndexNumber='50012030030000' OR IndexNumber='50013186000000' OR IndexNumber='50013111010000' OR IndexNumber='50012260010000' OR IndexNumber='50013187000000' OR IndexNumber='50001371000001' OR IndexNumber='50012806010000' OR IndexNumber='50005086040300' OR IndexNumber='50013187010000' OR IndexNumber='50012948000000' OR IndexNumber='50013021020000' OR IndexNumber='50012793000001' OR IndexNumber='50010986040000' OR IndexNumber='50011451070000' OR IndexNumber='50003440110000' OR IndexNumber='50012951000000'" myDB ProposedTo |sed -e "s|INSERT INTO|REPLACE INTO|" 2>&1 > proposedto-replace.sql;

When I ran it I got:

msqldump: Error in field count fot table: 'ProposedTo ! Aborting.

So that made me think the issue has to do with the where clause having a limitation of how many conditions it could have. Is there a Limit? If so would breaking it down to multiple mysqldump statements be best?
UmeshSenior Principal Technical Support EngineerCommented:
This is really strange error for me.. Did you see any error code in that?

Can you give a try for this.??

In your where condition instead of OR OR...

IndexNumber IN (50013157000000, etc etc)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
UmeshSenior Principal Technical Support EngineerCommented:
Did you try the one I suggested in above comment??
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.