View Full Version : query in db


ankit
12-01-2009, 04:01 AM
i try to do query 75 % i did but some of doesn't work please if know any one help me. i have this type of number W14-1024-01 this is incorrect number correct number is W14-1024-1. mean i want to take of 0. can't use replace because i have bunch of number like W14-0145-1. if i try to replace -01 to -1 the next correct number also change. please advise.

PaulO
12-01-2009, 06:04 AM
You haven't made your question cystal clear ... but what I think you want to do is replace all instances of -0 with -1 but only at the END of the reference number? i.e. not anywhere else?

You need to write an Update Query which finds records ending "-01" and replaces with "-1"

The key to the query is using the "mid" function to limit the records that get updated to just those that you wish to update

To do this, in your query, you need to utilise criteria as follows:-
mid([referencenumber],9,3) = "-01"
this will pick out the 9th and 10th characters and check whether they are "-01" and enable you to update JUST those records.

ankit
12-01-2009, 07:01 PM
Thank You very very much for help