Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Help with access Query

Help with access Query

Scheduled Pinned Locked Moved Database
databasehelpannouncement
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Gali1978
    wrote on last edited by
    #1

    have 2 tables: Table A: code | name Table B: barcode | name Table B has full barcode and name, Table A has only code. I need to run update query that fill name in Table A. I tried something like: update A set name = (select top 1 Name from B where B.Code = mid(A.Barcode,1,8)) but it doesn't work.

    C L 2 Replies Last reply
    0
    • G Gali1978

      have 2 tables: Table A: code | name Table B: barcode | name Table B has full barcode and name, Table A has only code. I need to run update query that fill name in Table A. I tried something like: update A set name = (select top 1 Name from B where B.Code = mid(A.Barcode,1,8)) but it doesn't work.

      C Offline
      C Offline
      Chris Meech
      wrote on last edited by
      #2

      update A set name = (select top 1 Name from B where B.barcode = mid(A.code,1,8))

      Does that work any better? :)

      Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]

      M 1 Reply Last reply
      0
      • G Gali1978

        have 2 tables: Table A: code | name Table B: barcode | name Table B has full barcode and name, Table A has only code. I need to run update query that fill name in Table A. I tried something like: update A set name = (select top 1 Name from B where B.Code = mid(A.Barcode,1,8)) but it doesn't work.

        L Offline
        L Offline
        Luc Pattyn
        wrote on last edited by
        #3

        and that is one more reason why giving appropriate names to everything is important. :)

        Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


        I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that.


        1 Reply Last reply
        0
        • C Chris Meech

          update A set name = (select top 1 Name from B where B.barcode = mid(A.code,1,8))

          Does that work any better? :)

          Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]

          M Offline
          M Offline
          masoumeh2010
          wrote on last edited by
          #4

          'mid' is not a recognized built-in function name.

          C 1 Reply Last reply
          0
          • M masoumeh2010

            'mid' is not a recognized built-in function name.

            C Offline
            C Offline
            Chris Meech
            wrote on last edited by
            #5

            Then you will need to find out what built-in function does string extraction and replace 'mid' with that function name. It probable that the parameters will be different to. :)

            Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups