473,385 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Trouble using Like Operator.....having a dumb friday

219 100+
I've got a table which contains some items that I need to compare against another table which contains a more detailed look at the items, and there could be multiple.

Example:

Table1:
Field: ACETAMINOPHEN

Table2:
Fields: ACETAMINOPHEN
ACETAMINOPHEN CHEWABLE
ACETAMINOPHEN DROPS
ACETAMINOPHEN SUPP
ACETAMINOPHEN SUSP
ACETAMINOPHEN W/COD #3
ACETAMINOPHEN W/COD ELIX
ACETAMINOPHEN W/COD LIQ 15ML

I want to be able to run a query which would look at ACETAMINOPHEN and retrieve all values from Table2 where the field is like ACETAMINOPHEN

Here is my query I'm using which returns 0 results:

Expand|Select|Wrap|Line Numbers
  1. SELECT TABLE1!PRIMARY_NAME AS OS_DRUG
  2. FROM TABLE1, TABLE2
  3. WHERE ((([TABLE2]![DETAILEDDRUG]*) Like [TABLE1]![PRIMARY_NAME]))
  4. ORDER BY TABLE1!PRIMARY_NAME;
  5.  
I tried using the below as well, but get no results.

Expand|Select|Wrap|Line Numbers
  1. SELECT TABLE1!PRIMARY_NAME AS OS_DRUG
  2. FROM TABLE1, TABLE2
  3. WHERE ((([TABLE2]![DETAILEDDRUG] + '*') Like [TABLE1]![PRIMARY_NAME]))
  4. ORDER BY TABLE1!PRIMARY_NAME;
  5.  
Apr 24 '09 #1
3 1583
NeoPa
32,556 Expert Mod 16PB
You don't say exactly what the fields are called and I suspect what you describe as field values are actually different records, but try this :
Expand|Select|Wrap|Line Numbers
  1. SELECT TABLE1.PRIMARY_NAME AS OS_DRUG,
  2.        TABLE2.DETAILEDDRUG AS DTL_DRUG
  3.  
  4. FROM   TABLE1 LEFT JOIN TABLE2
  5.   ON   (TABLE2.DETAILEDDRUG LIKE '*' & TABLE1.PRIMARY_NAME & '*')
  6.  
  7. ORDER BY TABLE1.PRIMARY_NAME
Apr 24 '09 #2
dmorand
219 100+
Excellent, that worked like a charm, I appreciate your help!!!!!
Apr 24 '09 #3
NeoPa
32,556 Expert Mod 16PB
Very pleased to hear it :)

Did you follow what and why though?
Apr 24 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Ney André de Mello Zunino | last post by:
Hello. I am having trouble with namespaces and unresolved externals. The following three files (memoria.h, memoria.cpp and teste.cpp) illustrate the problem: // *************** memoria.h...
3
by: belief | last post by:
I write a non-template simple string with the technique that giving the same string a same storage with a count. so i must give the necessary copy operation when the string will be modified, I...
7
by: JustSomeGuy | last post by:
I have two classes, class english and class metric. I seem to be having dificulty getting this to compile properly... I'm using powerpc-apple-darwin8-g++-4.0.0 There are 5 files, main.cpp...
80
by: Christopher Benson-Manica | last post by:
Of course one can get the effect with appropriate use of existing operators, but a ^^ operator would make for nice symmetry (as well as useful to me in something I'm working on). Am I the only one...
3
by: Howard Swope | last post by:
Greetings: C++ CLR .Net 2 I have a ref class that I have created that wraps an unmanaged pointer. It acts like a smart pointer for reference counted objects for a particular library I am...
6
by: MLH | last post by:
I have a query with a single table. One of the table fields appearing in the QBE grid is containing values from 1 to 127. Then I have the following calculated field named : Published: IIf((1...
0
by: parez | last post by:
On Apr 17, 3:50 pm, "sloan" <sl...@ipass.netwrote: I have posted this at 12.37pm EST Friday 18th april 08
9
by: itdevries | last post by:
Hi, I've ran into some trouble with an overloaded + operator, maybe someone can give me some hints what to look out for. I've got my own custom vector class, as a part of that I've overloaded...
0
by: mrchatgroup | last post by:
news from http://www.mrchat.net/myblog/myblog/small-accidents-mean-big-trouble-for-supercollider.html Small Accidents Mean Big Trouble for Supercollider Image Scientists expect startup...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.