473,396 Members | 1,895 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,396 software developers and data experts.

Get value of a specific field from a set of fields

99 64KB
I have a Table1:
Expand|Select|Wrap|Line Numbers
  1. ========================================
  2. ID    Opt1    Opt2      Opt3       Opt4
  3. ========================================
  4. 1     xxxx    yyyy      zzzzz      aaaaa
  5. 2     kkkkk   llllll    mmmmm      zzzzz
  6. 3     bbbbbb  cccccc    dddddd     eeeee
  7.  
  8.  
Another Table2:
Expand|Select|Wrap|Line Numbers
  1. ===========
  2. ID    Opts
  3. ===========
  4. 1     Opt2
  5. 2     Opt4
  6. 3     Opt1
  7.  
  8.  
I want a query to give:
Expand|Select|Wrap|Line Numbers
  1. =============
  2. ID    Values
  3. =============
  4. 1     yyyy
  5. 2     zzzzz
  6. 3     bbbbbb
  7.  
  8.  
or a combination:
Expand|Select|Wrap|Line Numbers
  1. ====================================================
  2. ID    Opt1    Opt2      Opt3       Opt4      Values
  3. ====================================================
  4. 1     xxxx    yyyy      zzzzz      aaaaa     yyyy
  5. 2     kkkkk   llllll    mmmmm      zzzzz     zzzzz
  6. 3     bbbbbb  cccccc    dddddd     eeeee     bbbbbb
  7.  
  8.  
Please note that the values of field ID from both tables are same.

Please help me. Thanking in anticipation.
Feb 22 '18 #1

✓ answered by gnawoncents

Try this as the SQL for your Query:
Expand|Select|Wrap|Line Numbers
  1. SELECT Table2.ID, DLookUp([Table2].[Opts],"Table1","[Table1].[ID] = " & [Table2].[ID]) AS [Values]
  2. FROM Table2;
  3.  

3 1134
gnawoncents
214 100+
Try this as the SQL for your Query:
Expand|Select|Wrap|Line Numbers
  1. SELECT Table2.ID, DLookUp([Table2].[Opts],"Table1","[Table1].[ID] = " & [Table2].[ID]) AS [Values]
  2. FROM Table2;
  3.  
Feb 23 '18 #2
mshakeelattari
99 64KB
Nice. It worked for me! Thank you.
Feb 23 '18 #3
gnawoncents
214 100+
You are quite welcome!
Feb 24 '18 #4

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

Similar topics

0
by: kkrizl | last post by:
I'm having a very bizarre problem. I open up my table in datasheet view, and I click on edit, find. In the Find and Replace dialog box, I enter an address (123 main for example). If I set the...
5
by: vandanavai | last post by:
Hello, I have problem in setting default value of field. What I want to do is as follows. I have 'Table' with fields 'PurchaseDate' and 'CapitalisationDate'. I want to set dafault value of field...
3
by: mckbill | last post by:
Is there a way I can direct the cursor to a specific field (variable) in a form by typing the field name while in form view? I have a form with many fields, and it would be nice if there were...
5
by: theine | last post by:
How do I create Hyperlink based of a specific field in the same row? In Excel it done like this: =HYPERLINK("", A273) where the anything inside the " " is the value it's looking for in that...
1
by: sukatoa | last post by:
I still do the process of incrementing a specific field in a stand alone apps by query 1: get its value query 2: update value +1 But, i realize that this is really a bad idea when this would...
3
by: Ron Mowry | last post by:
I am wanting to create a macro that will fill a specific field on a form and then go to the next record set. I have a blank field in the table that the form is pulling from. I want the user to be...
0
by: sourceinfo | last post by:
How do I set focus to a specific field in an external program? Our application is middleware that sends data to a different application through a port, but we then switch the screen focus to the...
29
by: lmott | last post by:
Good evening I have a database where I a command button that when pressed I wan to see the value from the previous record/field and then add 1 to it. I have never built a code where I had to look...
6
by: theberner | last post by:
I have a report, Report A, that pulls data from a Table, Table A. Table A, has a field, Field A, where I am to export Report A for each Unique Entery in Field A. Currently I have to do this...
2
by: feeeee | last post by:
I have seen again and again that lookup fields are to be avoided in tables. My question is: Are all types of lookup fields evil? I have avoided lookup fields that pull data from other tables. ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.