473,769 Members | 2,085 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Column and record consolidation problem.

5 New Member
Column Consolidation.

My problem is this. I have to sort each of the def1-def23 columns from the old table into the def1-def6 columns from the new table preserving the other data in the records. So basically, i have 23 categories that I have to sort into 6 broader or more general categories.

I have tried updating/appending the data in the query design view, but I end up with syntactic errors every time due to my lack of knowledge. Below is a sample of the old table and the new table.

Old/current table format:
1. photonum text
2. streetnum text
3. streetname text
4. insdate date
5. front yes/no
6. right yes/no
7. left yes/no
8. rear yes/no
9. def1 yes/no
10. def2 yes/no
11. def3 yes/no
12 def4 yes/no
13 def5 yes/no
.......
31. def23 yes/no
32. bottom yes/no
33. middle yes/no
34. top yes/no

new table:
1. photonum text
2. streetnum text
3. streetname text
4. insdate date
5. front yes/no
6. right yes/no
7. left yes/no
8. rear yes/no
9. def1 yes/no
10. def2 yes/no
11. def3 yes/no
12 def4 yes/no
13 def5 yes/no
14. def6 yes/no
15. bottom yes/no
16. middle yes/no
17. top yes/no


On the same coin:
Record Consolidation

In those same tables, how would I go about consolidating records in this fashion?

so this:
photo streetnum streetname def1 def2 def3 def4 def5
1.jpg 123 maple true true false false false
2.jpg 123 maple false true true false false
3.jpg 123 maple true false false false true

can become this:
photo streetnum streetname def1 def2 def3 def def5
moot 123 maple true true true false true

Please point me in the right direction, any help would be appreciated.
There are roughly 35,000 records, which rules out doing it by hand in a timely manner.


Thank You
Jul 9 '07 #1
10 1720
NeoPa
32,573 Recognized Expert Moderator MVP
You haven't said anything about how the 23 old categories are merged into the new ones. You have 6 new categories but no information as to what goes where.
Jul 9 '07 #2
bobtehdog
5 New Member
You haven't said anything about how the 23 old categories are merged into the new ones. You have 6 new categories but no information as to what goes where.
That is simple enough.

def1 gets numbers 2,4,5,12, 21, 22 and 23
def2 gets just number 3
def3 gets just number 1
def4 gets numbers 6,9,10,11,13,15 ,16 and 17
def5 gets number 19
def6 gets numbers 7,8,14 and 20

Thank you.
Jul 9 '07 #3
NeoPa
32,573 Recognized Expert Moderator MVP
Simple would be finding the relevant information in the question ;)

Unfortunately, if I'm reading what you have written correctly, then you have also omitted to explain how your consolidation should work. It seems that a group of the old records get written as a single new one. Perhaps you could explain how this should work in your scenario?
Jul 9 '07 #4
bobtehdog
5 New Member
Simple would be finding the relevant information in the question ;)

Unfortunately, if I'm reading what you have written correctly, then you have also omitted to explain how your consolidation should work. It seems that a group of the old records get written as a single new one. Perhaps you could explain how this should work in your scenario?
I am using access 2007 by the way. Thank You for your patience.

I'm sorry for not being clear enough. I posted two separate issues in the same thread.

The first issue is that i have 35,000 records that are identified by photo number and address. Each record has columns def1 through def23, which needs to change into def1-def6 in the new table. So if def2, def4, and def5 are the only boxes checked in the old table for that record, the new table will only have def1 checked and all the other information verbatim. What I have been trying to do is an append query and messing with the conditional statements.

The second issue involves a way to summarize these records, so as to only display the address once, and have some kind of statement that checks the box for that address if it has been checked in the data table.
old data:
123 street 01100
123 street 00110
123 street 01001

summary data:
123 street 01111

Again, these were two separate issues. I apologize for any confusion and appreciate any help. I have been trying this mostly using queries. If i should use another part of access please let me know.
Jul 9 '07 #5
NeoPa
32,573 Recognized Expert Moderator MVP
I appreciate this last response. It makes the whole thing a lot clearer.
It probably would have been better to separate the two questions into their individual threads originally, but I think we can make progress from here nevertheless.
Your problem is complicated, not so much by the fundamental nature of it, but more by the large number of fields and the non-standard way that different fields are worked out.
Give me some time and I will try to put something together for you. This will not be the final answer mind, simply pointers to the right way of going about it. Concepts.

Let me clarify your second question somewhat :
Which fields, being the same, should indicate that the records should be treated as one? Is it possibly StreetName & StreetNum?
I presume the consolidation is done on the data in the new table which results from question one.
For the six boolean (Yes/No) categories you want them grouped together but the booleans should be treated as being ORed together? By that, I mean should the result be TRUE if any of the component fields be TRUE, but otherwise FALSE?

PS. I will be going to bed very soon so any response will have to wait at least until tomorrow now I'm afraid.
Jul 9 '07 #6
bobtehdog
5 New Member
This is all very correct. I would like to add that I have been learning scores about how to and how not to do things in access, starting with the design.

I appreciate this last response. It makes the whole thing a lot clearer.
It probably would have been better to separate the two questions into their individual threads originally, but I think we can make progress from here nevertheless.
Your problem is complicated, not so much by the fundamental nature of it, but more by the large number of fields and the non-standard way that different fields are worked out.
Give me some time and I will try to put something together for you. This will not be the final answer mind, simply pointers to the right way of going about it. Concepts.

Let me clarify your second question somewhat :
Which fields, being the same, should indicate that the records should be treated as one? Is it possibly StreetName & StreetNum?
I presume the consolidation is done on the data in the new table which results from question one.
For the six boolean (Yes/No) categories you want them grouped together but the booleans should be treated as being ORed together? By that, I mean should the result be TRUE if any of the component fields be TRUE, but otherwise FALSE?

PS. I will be going to bed very soon so any response will have to wait at least until tomorrow now I'm afraid.
Jul 9 '07 #7
NeoPa
32,573 Recognized Expert Moderator MVP
This is all very correct. I would like to add that I have been learning scores about how to and how not to do things in access, starting with the design.
I should take this to mean that all my guesses were on target then. Good.
I should warn you that I have a couple of hectic days ahead - looking at universities for my son. I will do what I can of course, but please be patient with me as my access to the web will be limited during that period.
Jul 9 '07 #8
bobtehdog
5 New Member
ok, my solution was this. new_data is a blank table. data_tmp is a copy the original table. i've been sitting on a "learn sql in ten minutes" book. i took about four hours to study the book, and started to fiddle with access. got real sick of access 2007, and started a blank query in sql view. didn't take long for me to work this out after getting my bearings. anything more complex, and i would have been toast for sure. thank you for your help.

Expand|Select|Wrap|Line Numbers
  1. INSERT INTO new_data
  2.  ( photo_num, inspection_date, street_number, street_name, front, [right], [left], rear, gen1, gen2, gen3, gen4, gen5, gen6, bottom, middle, [top] )
  3. SELECT 
  4. photo_num, inspection_date, street_number, street_name, front, [right], [left], rear, 
  5. def2 OR def4 OR def5 OR def12 OR def21 OR def22 OR def23, 
  6. def3, 
  7. def1, 
  8. def6 OR def9 OR def10 OR def11 OR def12 OR def13 OR def15 OR def16 OR def17 OR def18,
  9. def19,
  10. def7 OR def8 OR def14 OR def20,
  11. bottom,
  12. middle,
  13. [top]
  14. FROM data_tmp;
Jul 10 '07 #9
NeoPa
32,573 Recognized Expert Moderator MVP
Good answer, and helpfully laid out (otherwise this could get messy).
For clarification purposes (Your SQL should work fine without this), I would add the names of the formula fields (gen1-gen6) into your SQL. This specifies explicitly to any reader what goes where and should make life a little easier later :
Expand|Select|Wrap|Line Numbers
  1. INSERT INTO new_data
  2.  ( photo_num, inspection_date, street_number, street_name, front, [right], [left], rear, gen1, gen2, gen3, gen4, gen5, gen6, bottom, middle, [top] )
  3. SELECT
  4.  photo_num, inspection_date, street_number, street_name, front, [right], [left], rear, 
  5.  def2 OR def4 OR def5 OR def12 OR def21 OR def22 OR def23 AS gen1, 
  6.  def3 AS gen2, 
  7.  def1 AS gen3, 
  8.  def6 OR def9 OR def10 OR def11 OR def12 OR def13 OR def15 OR def16 OR def17 OR def18 AS gen4,
  9.  def19 AS gen5,
  10.  def7 OR def8 OR def14 OR def20 AS gen6,
  11.  bottom,
  12.  middle,
  13.  [top]
  14. FROM data_tmp;
Jul 10 '07 #10

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

Similar topics

6
3076
by: 6thirty | last post by:
Hi, I've created a stocktaking database using Access XP. This is indexed by two fields - part number and shelf location. I am currently inputting all the data via a form. When I have entered a record such as: part number 202354-001 location C1-01
3
2269
by: daveS | last post by:
I have come accross the exact same problem as below. The address that was given as a solution cannot be found. Specifically, i need to be able to show labels in only the first column of a report! Could someone please help! ***************************************************** Message 6 in thread From: fredg (fgutkind@att.net) Subject: Re: Row headings in a column-based report
5
4602
by: Lynn C | last post by:
I have a combobox column in a datagrid. (I am using the example from Geoge Shepard's website on deriving a custom column style from DataGridTextBoxColumn). The problem I am having is when you make a selection in the combobox, for a new record, the selected value does not appear until you tab out of that column. This only happens on a new record. If I change the value on an existing record, the combo box reflects my selection. Thanks, Lynn...
6
5072
by: Alpha | last post by:
I retrieve a table with only 2 columns. One is a auto-generated primary key column and the 2nd is a string. When I add a new row to the dataset to be updated back to the database. What should I do with the 1st column ? (Below I have a "1" in place for now). Also, Does the datase.AcceptChanges(); updates the changes to the database? Which command do I use to update the changes in dataset back to the Access database table? Thanks, Alpha...
2
2769
by: .Net Newbie | last post by:
Hello, I am somewhat new to .Net and currently working on an intranet site using C# going against SQL Server 2k. I am accepting personal information on a single webform and trying to insert the information into three separate tables (all in a single aspx page -- without using stored procedures, yet). The first SQL Statement accepts the persons most detailed information, like name, address, phone, etc and inserts the single record into...
6
10680
by: Aaron Smith | last post by:
Ok. I have a dataset that has multiple tables in it. In one of the child tables, I have a column that I added to the DataSet (Not in the DataSource). This column does not need to be stored in the data on the datasource. It simply gets the first name and last name of an instructor and displays it in the grid. I have two major problems.... One, it doesn't display in the column until the row is saved, (Even after calling a refresh on the...
6
10501
by: ApexData | last post by:
I have 2 tables: Table1 and Table2. Neither one has a primary key because each table will only have 1-record. My form is a SingleForm unbound with tabs (my desire here). Using this form, in the Record Source I originally had the statement TABLE1, and all worked fine. Now I want to open the second table as well, and this is where my problem is.
2
6550
by: Exick | last post by:
This is more of a minor annoyance/curiosity than a real problem, but I'm wondering if anyone here can provide some answers. I have a form bound to a table with lots of controls on it that are bound to fields of said table. I also have a combo box on the form that is unbound. I'm using it purely as a search mechanism. Anyway, the combo box dropdown is populated with data from a SQL query. There are 5 fields total, only the first 2 are...
4
4131
by: =?Utf-8?B?QW1pciBUb2hpZGk=?= | last post by:
Hi I have a GridView that is displaying master records. Some of these records have child records. I would like to a column to my master GridView such that for each master record that has detail records, it displays a hyperlink that then takes the user to the details page. If a master record doesn't have any children, I just want it to display its ID with no hyperlink.
0
9423
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10216
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10049
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9997
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9865
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5309
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3965
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.