473,396 Members | 2,011 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.

My Final Query/Script- Please Help with Moving field data between tables

1
Hi all, please help ASAP!

Well, it's been a long and bumpy ride, but my little Access DB is finally graduating and moving out of the house. My homebrewed contact and sales database is being taken over by the big leagues and converted by a pro company to a web-based SQL database- well outside my realm of abilities.

I have one more duty to perform, then I'm out of the DB business for the forseeable future.

Heres the basic structure boiled down:

Table 1: Field A, Field B, Field C
Table 2 (1-Many on "Field C"): Field C, Field D, Field E, Field F

I need to move Fields E and F from Table 2 to Table 1. The problem is that there are many entries for D, E, F for Each C in Table 1. What I need is a query or script that will take the FIRST (earliest) record of each Field C group and move the data from E and F in that record to the new fields in Table 1.

I have spent hours playing with Totals functions in queries, and just can't seem to get the right information displayed to make the switch.

Make sense?

Thanks!
Dec 19 '06 #1
1 1573
MMcCarthy
14,534 Expert Mod 8TB
This should create a new table with the fields you want. You can rename the tables later.

Expand|Select|Wrap|Line Numbers
  1. INSERT INTO NewTableName (FieldA, FieldB, FieldC, FieldE, FieldF)
  2. SELECT Table1.FieldA, Table1.FieldB, First(Table2.FieldC), First(Table2.FieldE), First(Table2.FieldF)
  3. FROM Table1 LEFT JOIN Table2
  4. ON Table1.FieldC = Table2.FieldC
  5. GROUP BY  Table1.FieldA, Table1.FieldB;
  6.  
Mary
Dec 21 '06 #2

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

Similar topics

2
by: Donald Firesmith | last post by:
I am having trouble having Google Adsense code stored in XSL converted properly into HTML. The <> unfortunately become &lt; and &gt; and then no longer work. XSL code is: <script...
2
by: Santosh | last post by:
Hi, I have a script running which fails when it tries to execute an Update query, but when i try to run the query from the SQLQueryAnalyzer it runs fine. Can somebody try and explain this...
8
by: dstefani | last post by:
Hello, I was wondering if you can get the info from the query string in a server-side javascript tag? Here's what I'm trying to do In the head of page A ....
3
by: Dr. Oz | last post by:
Hi, I am trying to read in a query string from one page and build a link to another page based on the query string. Here's the code I am using to read in the query string: <script...
9
by: sohan | last post by:
Hi, I want to know how to connect and execute a db2 query from inside a UNIX shell script. Details: We have a unix shell script. We need to execute multiple db2 sql queries from this shell...
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
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...

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.