473,461 Members | 1,421 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Query Question

83
I have a 2 tables. They are linked together by the primary key of the (one) table and one of the primary keys of the (many) table. When I bring the two tables in the query I get separate entries for each of the lines in the many table, but I would like for the fields of the "many" table to be added horizontally to all of the cases in the "one" table. Does anyone know of a way to do this?
Jul 3 '07 #1
5 1243
NeoPa
32,556 Expert Mod 16PB
Do you mean a GROUP BY?
Or are you talking about a record which is as wide as there are records?
Jul 3 '07 #2
jl2886
83
There is no grouping involved.
I have two tables:
Ex)
Main Table
Case # Other Fields
112-112 blah blah blah

Other Table
Case # Other Fields(not the same as the main table)
112-112 blah
112-112 blahh
112-112 blahhh
112-112 blahhhh


I want to then want to create a query that looks like this:
Case # Other Fields Other Fields(not the same as the main table)
112-112 blah blah blah blah blahh blahhh blahhhh
Jul 5 '07 #3
NeoPa
32,556 Expert Mod 16PB
This is not really supported by an RDBMS like Access (as it doesn't make database sense).
However, other people have requested similar things so I designed a bodgy way around this. Check it out at (Combining Multiple Rows of one Field into One Result)
Jul 5 '07 #4
jl2886
83
I do not want them combined to one field, sorry.
Here is what the query looks like now:
Case Number 5 Fields from the Many Table 20 Fields from the One Table
507-111
507-111
507-111
etc.

The 5 Fields from the many table are different for each case number, but the 20 Fields from the one table are the same for all case numbers. I want it to look like this:

(Case Number) (Fields from first(507-111) entry) (5 Fields from Second (507-111) entry) (5 Fields from third entry) 20 fields from the One Table
So, now there is only one 507-111 entry


The problem is, I want to be able to rename the fields from the many table based on the information in one of the fields. Or else, there would be 3 sets of 5 Fields with the same field name.
Jul 9 '07 #5
NeoPa
32,556 Expert Mod 16PB
Your problem is much, much bigger than that.
There is no way that I know of (short of some fairly convoluted bespoke code) to produce output as you describe. Again, that is quite foreign to the concepts of an RDBMS. I'm assuming (as you haven't said otherwise) that the numbers of records vary from case to case. Even if it were static at three, that would not be straightforward.
Fundamentally, a query is defined before it is run. Varying the number of fields at run-time is not easily supported. Cross-tab queries do something along those lines but are highly specific.
Jul 9 '07 #6

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

Similar topics

9
by: majsen | last post by:
Hi, I have problem running this query. It will time out for me... My database are small just about 200 members. I have a site for swaping appartments (rental). my query should look for match in...
8
by: Együd Csaba | last post by:
Hi All, how can I improve the query performance in the following situation: I have a big (4.5+ million rows) table. One query takes approx. 9 sec to finish resulting ~10000 rows. But if I run...
3
by: John Ortt | last post by:
> I have a table of dates in ascending order but with varying intervals. I > would like to create a query to pull out the date (in field 1) and then pull > the date from the subsequent record...
3
by: Ekqvist Marko | last post by:
Hi, I have one Access database table including questions and answers. Now I need to give answer id automatically to questionID column. But I don't know how it is best (fastest) to do? table...
7
by: serge | last post by:
How can I run a single SP by asking multiple sales question either by using the logical operator AND for all the questions; or using the logical operator OR for all the questions. So it's always...
6
by: jjturon | last post by:
Can anyone help me?? I am trying to pass a Select Query variable to a table using Dlookup and return the value to same select query but to another field. Ex. SalesManID ...
2
by: mmitchell_houston | last post by:
I'm working on a .NET project and I need a single query to return a result set from three related tables in Access 2003, and I'm having trouble getting the results I want. The details: ...
22
by: Stan | last post by:
I am working with Access 2003 on a computer running XP. I am new at using Access. I have a Db with a date field stored as mm/dd/yyyy. I need a Query that will prompt for the month, ie. 6 for...
3
by: Richard Hollenbeck | last post by:
I am very sorry about the (almost) re-post, but you will see that my first question wasn't very clear; I have another question I posted this morning called, "in DAO: Run time error 3061 Too few...
16
by: ARC | last post by:
Hello all, So I'm knee deep in this import utility program, and am coming up with all sorts of "gotcha's!". 1st off. On a "Find Duplicates Query", does anyone have a good solution for...
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...
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
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: 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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.