473,408 Members | 2,734 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,408 software developers and data experts.

difficulties creating a complex query

bau
Hi everybody,

I am using MS Access 2003 to prepare data for a scientific study. I
have a table which look like that:

"Customer" "Store" "Product" "Price" "week"
"100" "Supermarket1" "XProduct" 2,20 $ 5
"101" "Supermarket2" "YProduct" 2,05 $ 2
"102" "Supermarket1" "ZProduct" 2,10 $ 1
"103" "Supermarket2" "XProduct" 2,05 $ 3
"104" "Supermarket1" "YProduct" 1,95 $ 4
"105" "Supermarket2" "ZProduct" 2,05 $ 6
"100" "Supermarket1" "XProduct" 1,90 $ 7
"103" "Supermarket2" "YProduct" 1,90 $ 8
"105" "Supermarket1" "ZProduct" 2,05 $ 1
"102" "Supermarket2" "XProduct" 2,00 $ 2
"101" "Supermarket1" "YProduct" 2,20 $ 6
"104" "Supermarket2" "ZProduct" 2,20 $ 3
"100" "Supermarket1" "XProduct" 1,95 $ 9
"102" "Supermarket2" "YProduct" 2,05 $ 4
"105" "Supermarket1" "ZProduct" 2,00 $ 5
The table shows the product a consumer made in a specific supermarket
in a specific week at a certain price.
I need to create a query which displays the customers choice as above
including all other products the supermarket sold within a 5 week time
period (and excluding the product he/she bought) with their average
prices. Thus the output would be all the choices the consumer faced
when buying the product.
To illustrate what I would like to create, here an example output using

the first row from teh above table.
"Customer" "Store" "Product" "Price" "week" "choosen"
"100" "Supermarket1" "XProduct" 2,20 $ 5 "true"
"100" "Supermarket1" "ZProduct" 2,05 $ 5 "false"
"100" "Supermarket1" "YProduct" 2,08 $ 5 "false"
So consumer with id 100 chose "Xproduct" and also saw most likely
ZProduct and YProduct, but did not choose them. I hope that example
clarifies my goal.
I would like to do this in pure SQL if possible. Any help would be very
much appreciated!
Regards,
Ray

Jan 3 '07 #1
1 1288
Answered in microsoft.public.access
Jan 3 '07 #2

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

Similar topics

4
by: Starbuck | last post by:
OK, first let me say that I am no DB person. But I have a user here who keeps getting this error whenever she does, whatever it is she does, with databases... A google search takes me to...
2
by: Mikel | last post by:
I am trying to get around the problem "The expression you have entered is too complex" for a select query. (The example below is not the expression that is giving me headaches.) So I am thinking...
5
by: Ilan Sebba | last post by:
When it comes to adding records in related tables, Access is really smart. But when I try to do the same using ADO, I am really stupid. Say I have two parent tables (eg Course, Student) and one...
8
by: Matt | last post by:
Hi all, Thank you for taking the time. I have a database with 45 tables on it. 44 tables are linked to a main table through a one to one relationship. My question is, is there no way i can...
0
by: Julia | last post by:
Hi, I am still having Charest conversion difficulties s when passing string from C# TO ASP and than to access using ADO I am using HttpWebRequest to POST some Multilanguage(Hebrew and...
1
by: BestofAbhi | last post by:
I am consuming Java Web Services in .NET. The Java Web Services have been coded using Apache Axis. The binding style in the WSDL is 'Document' and type is 'Literal'. I have added these Java...
1
by: arun | last post by:
Query is too complex -------------------------------------------------------------------------------- Hi, I was trying to solve this problem since last two days but couldn't find any solution. ...
1
by: Randy Volkart | last post by:
I'm trying to fix a glitch in a complex access database, and have a fairly complex problem... unless there's some obscure easy fix I don't know being fairly new with Access. Basically, the area...
0
crystal2005
by: crystal2005 | last post by:
Hi, I am having trouble with some complex SQL queries. I’ve got winestore database, taken from Web Database Application with PHP and MySQL book. And some question about queries as the following ...
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
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
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.