Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6615377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:27:15+00:00 2026-05-25T20:27:15+00:00

I have two tables, the value of NDC_10 for table test is a 10

  • 0

I have two tables, the value of NDC_10 for table test is a 10 digit code while the value of PRODUCTNDC in table product is a 8 digit code. I am trying to select all of the rows in which the 8 digit code is inside the 10 digit code such as:
0123456789 = 10 digits
12345678 = 8 digits

I have come up with something like this logically, but I do not know how to nest the 2 wild characters inside the search of the other table

select NDC_10
FROM test, product
WHERE (NDC_10 LIKE '_product.PRODUCTNDC_')
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T20:27:16+00:00Added an answer on May 25, 2026 at 8:27 pm
    select t.NDC_10, p.NDC_8
    FROM test t
    INNER JOIN product p ON (LOCATE(p.NDC_8,t.NDC_10) <> 0)
    

    See: http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_locate
    And: http://www.codinghorror.com/blog/2007/10/a-visual-explanation-of-sql-joins.html

    And never ever use implicit join syntax, it is an antipattern.
    The reason is that it’s too easy to do a cross join which in 99,99% of all cases is not what you want.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I Have a database called 'lms' with two tables loan and value, table loan
I have two tables: CREATE TABLE Table1 ( ID VARCHAR(15), Value INT ); INSERT
I have two tables that store value as VARCHAR . I'm populating table and
I have two tables like this:- TABLE A ITEM LOCATION CODE A WHS QW123
I have two tables, a destination for the update: create table dest (value int)
I have two tables: TABLE 1 ID VALUE 1 ABC 2 DEF 3 GHI
I have two tables as follows PRODUCT table Id | Name | Price And
I have two tables nol_art and #tmpIzm I want to update nol_art with value
I have two tables with a weak relation. I need get a text value
I have two tables --> Variables (id, name) and Variable_Entries (id, var_id, value). I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.