473,385 Members | 1,873 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.

Can this be done in a query? Probably easy for some of you.

Hello, looking for some input on how to do this query. (I'm using
Access)

John Doe 123 Main St Chicago 123
John Doe 123 Main St Chicago 456
John Doe 123 Main St Chicago 789
Given the above data (thousands of customers by the way) how can I get
a query to return the following?

Column1 Column2 Column3 Column4
John Doe 123 456 789
I don't even know if this is possible, I can't figure it out.

Thanks for any help.
Nov 13 '05 #1
3 1257
da**********@yahoo.com (David Mills) wrote in message news:<8b**************************@posting.google. com>...
Hello, looking for some input on how to do this query. (I'm using
Access)

John Doe 123 Main St Chicago 123
John Doe 123 Main St Chicago 456
John Doe 123 Main St Chicago 789
Given the above data (thousands of customers by the way) how can I get
a query to return the following?

Column1 Column2 Column3 Column4
John Doe 123 456 789
I don't even know if this is possible, I can't figure it out.

Thanks for any help.


don't think you can denormalize your data with just a query... I would
probably output my data to Excel and see if I couldn't do a
Transpose...
Nov 13 '05 #2
pi********@hotmail.com (Pieter Linden) wrote in
news:bf**************************@posting.google.c om:
da**********@yahoo.com (David Mills) wrote in message
news:<8b**************************@posting.google. com>...
Hello, looking for some input on how to do this query. (I'm using
Access)

John Doe 123 Main St Chicago 123
John Doe 123 Main St Chicago 456
John Doe 123 Main St Chicago 789
Given the above data (thousands of customers by the way) how can I
get a query to return the following?

Column1 Column2 Column3 Column4
John Doe 123 456 789
I don't even know if this is possible, I can't figure it out.

Thanks for any help.


don't think you can denormalize your data with just a query... I would
probably output my data to Excel and see if I couldn't do a
Transpose...


You could write a static function like this:

static function InstanceOf(something) as integer
static somethingelse
if somethingelse = something then
InstanceOf = InstanceOf+1
else
InstanceOf = 1
end if
end function

Then, you can add this function to your query (important: it needs to be
ordered!)

select InstanceOf(Name) as Instance, name, address, city, code
from theTable
order by name

to get this:

1 John Doe 123 Main St Chicago 123
2 John Doe 123 Main St Chicago 456
3 John Doe 123 Main St Chicago 789
....now, you can do a cross-tab based on this query. Set name, address,
city as row headers, the Instance field as the column header, and first
(code) as the value. You need to apply a summary function to the field
intended to be the Value field in the crosstab.

This will get you:

1 2 3
John Doe 123 Main St Chicago 123 456 789

etc.

The drawback about this is that the function will fire off at just about
every excuse that the query has for being refreshed... But since Access
doesn't have anything like a Rownum pseudocolumn field like Oracle, or an
equivalant in Sql Server...

Having an autonumber field won't work, either. You cannot guarantee
sequential inserts of similar data, right?
Nov 13 '05 #3
da**********@yahoo.com (David Mills) wrote in
news:8b**************************@posting.google.c om:
Hello, looking for some input on how to do this query. (I'm
using Access)

John Doe 123 Main St Chicago 123
John Doe 123 Main St Chicago 456
John Doe 123 Main St Chicago 789
Given the above data (thousands of customers by the way) how
can I get a query to return the following?

Column1 Column2 Column3 Column4
John Doe 123 456 789
I don't even know if this is possible, I can't figure it out.

Thanks for any help.


If your need is really that simple, use the crosstab query wizard.
I suspect that your column of numbers is much more complex. Explain
what it represents and we can think about your problem a little
more cogently.
--
Bob Quintal

PA is y I've altered my email address.
Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: MVM | last post by:
Hello everyone, I need some help building a query using three tables and I am having difficulty writing the query. Here are the tables: GENERAL: GID - primary key PARCEL EDITDATE MAPCODE
10
by: Marizel | last post by:
I'm not sure there's an easy solution to this, but thought I'd ask. I often find myself with a query which I'd like to reuse, but with a different datasource. These datasources generally have...
7
by: Riley DeWiley | last post by:
I am continually amazed by SQL's ability to humble me .... I have a toy query into a toy database that looks just like this: SELECT . FROM f, fw, w WHERE f.id = fw.fid and fw.wid = w.id and...
13
by: Lee | last post by:
Hello All, First of all I would like to say thank you for all of the help I have received here. I have been teaching myself Access for about 4 years now and I've always been able to find a...
9
by: MLH | last post by:
I have a table (tblCorrespondence) holding records with fields like , , , , , , , etc... About a dozen 's are defined and I often use queries to extract records of a given . That's pretty easy....
1
by: Joshua Belden | last post by:
Okay, how I get myself into these situations, I don't know, but I have to design a component to plug into a C# Windows Forms application that allows the user to design a sql query. I'm thinking of...
10
by: Jaye | last post by:
Hi. I am a relative newbie to ASP and I am working on an application that uses ASP and an Oracle 9i database. I have a form that allows the user to query the database by selecting a client name(s)...
6
by: jsacrey | last post by:
Hey everybody, got a secnario for ya that I need a bit of help with. Access 97 using linked tables from an SQL Server 2000 machine. I've created a simple query using two tables joined by one...
2
by: Coll | last post by:
I have a form and a query. I would like to have some control on the form (check box probably), that when selected will limit the criteria for a field in a query. Here are the details.... When...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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...

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.