-2

. Hi, I do not know SQL, so I would like a someone to do me a big favor and provide me with the complete SQL to copy and paste into a blank query.

I would like to create an action query, to delete certain text in the field “USER_1” in my parts table, based on my criteria below:

1: If the field user1 contains text with parenthesis and the first word in the parenthesis begins with the word "USE" example: "Widget, 2mm x 0.5mm (USE made to Order, dont backorder)", Then I would like the action query to update the text to "USER_1" to be "Widget, 2mm x 0.5mm".

  1. if the description’s prefix begins with "C/" or "U/" or "U/C*" or "S/" or "M/" or “C/U*”, then I want the prefix omitted from the description as well. Example: if the description is like "U/Widget, 2mm x 0.5mm”, Then I would like the action query to update the text in field "user_1" to be "Widget, 2mm x 0.5mm".

Some descriptions may contain both of the above criteria, with a prefix and the Parenthesis. If this is the case, then I want to omit both the prefix and the parenthesis. Example: If the description is like "C/Widget, 2mm x 0.5mm (USE Made to order, dont backorder)" then I want field "user_1" to be "Widget, 2mm x 0.5mm”.

I need the criteria not to be case sensitive, so it should delete the text regardless if it is upper or lower case.

thank you very much in advance! Nathaniel

SELECT p.ID, p.USER_1

FROM SYSADM_PART AS p;

1
  • 3
    Sorry, this site is for help with problems, not "do this for me".
    – Marc B
    Dec 5, 2011 at 5:21

1 Answer 1

1

You are using MS Access, which has a query design window which will guide you through creating the SQL you need. That is the strength of Access, you do not need to know SQL to create moderately complex queries. You can also read up on SQL in Access in these three articles:

Fundamental Microsoft Jet SQL for Access 2000
Intermediate Microsoft Jet SQL for Access 2000
Advanced Microsoft Jet SQL for Access 2000

You might also like to read about mid, right, left, instr, instrrev and replace

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.