473,785 Members | 3,417 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
10 1723
NeoPa
32,577 Recognized Expert Moderator MVP
The second issue would be done by using the GROUP BY clause.
Queries in Access can be viewed either in the Design grid or the SQL view. I would suggest that it may be good experience for you to look at the resultant query in the design grid after entering it into the SQL view. Does that make sense? Maybe worthwhile for the previous answer too. That way you can become more comfortable using the Design grid, which is usually quicker and easier to develop in.

Anyway, on to the consolidation. This will work by getting the minimum value of the booleans gen1 - gen6 (separately). This relies on the TRUE value == -1 and FALSE == 0. Any non-zero value is treated as true in SQL but only TRUE (-1) = TRUE.
To illustrate :
If TRUE Then Print X ==> X
If -1 Then Print X ==> X
If 1 Then Print X ==> X
If TRUE = -1 Then Print X ==> X
If TRUE = 1 Then Print X ==> Nothing
If 555 Then Print X ==> X
If TRUE = 555 Then Print X ==> Nothing
Note also, those items that are neither GROUPed BY, nor processed through an aggregate function (EG. Min()), cannot be included in a GROUP BY query.
Expand|Select|Wrap|Line Numbers
  1. SELECT street_number,
  2.        street_name,
  3.        Min(gen1) AS MinGen1,
  4.        Min(gen2) AS MinGen2,
  5.        Min(gen3) AS MinGen3,
  6.        Min(gen4) AS MinGen4,
  7.        Min(gen5) AS MinGen5,
  8.        Min(gen6) AS MinGen6
  9. FROM new_data
  10. GROUP BY street_number, street_name;
Jul 10 '07 #11

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

Similar topics

6
3077
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
2271
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
4603
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
5073
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
2771
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
10681
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
10502
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
6551
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
4132
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
10315
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
10147
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
10085
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
9947
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
8968
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6737
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
5379
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
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.