473,657 Members | 2,538 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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" "Supermarke t1" "XProduct" 2,20 $ 5
"101" "Supermarke t2" "YProduct" 2,05 $ 2
"102" "Supermarke t1" "ZProduct" 2,10 $ 1
"103" "Supermarke t2" "XProduct" 2,05 $ 3
"104" "Supermarke t1" "YProduct" 1,95 $ 4
"105" "Supermarke t2" "ZProduct" 2,05 $ 6
"100" "Supermarke t1" "XProduct" 1,90 $ 7
"103" "Supermarke t2" "YProduct" 1,90 $ 8
"105" "Supermarke t1" "ZProduct" 2,05 $ 1
"102" "Supermarke t2" "XProduct" 2,00 $ 2
"101" "Supermarke t1" "YProduct" 2,20 $ 6
"104" "Supermarke t2" "ZProduct" 2,20 $ 3
"100" "Supermarke t1" "XProduct" 1,95 $ 9
"102" "Supermarke t2" "YProduct" 2,05 $ 4
"105" "Supermarke t1" "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" "Supermarke t1" "XProduct" 2,20 $ 5 "true"
"100" "Supermarke t1" "ZProduct" 2,05 $ 5 "false"
"100" "Supermarke t1" "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 1301
Answered in microsoft.publi c.access
Jan 3 '07 #2

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

Similar topics

4
8965
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 various forums where I am forced to sign up before I can read any answers. Interesting note here is that the guy in the office next
2
6070
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 that I just need to do the parsing and calculating in an event procedure for an "On Click" event. My question is: If I have a query field in access97 that parses date (in format
5
4329
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 child table (StudentProgress). The course progress records how a student progresses on a course. I have one course (History) and one student called Maya. I now want to record her grade (64). If I do this in Access using a form, then the form...
8
5058
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 have a query that will pull a single field from all the tables. In other words i should have 44 fields. when i try to do that same, i get an error message saying "Query is too complex"
0
1209
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 English) to an ASP page which in turn uses ADO to save them to an access data base the access data base support(as I underatdn( UNICODE strings),I can insert Hebrew string fro access IDE)
1
4381
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 Web Services both as Web Reference and Reference (ie dll generated using wsdl.exe) in the Project in order to access them. I am able to get the output for web methods that return just a string. However when it comes to complex data like an object /...
1
2663
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. I wanted to execute a query which is retrieving the records from table1 by checking the condition for a long long string . I'm using where clause and checking the condition as-
1
2802
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 I'm trying to fix includes a form which takes entered data, concatenates it into a VB string to form an SQL query, then launches a report with information from the query. Several tables are linked in the query, but the key ones for this problem...
0
2444
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 1. The wine name, grape variety, year, winery, and region 2. The minimum cost of wine in the inventory 3. The number of bottles available at the minimum price 4. The total number of bottles available at any price 5. The total number of unique...
0
8324
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
8842
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
8740
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...
0
8617
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...
1
6176
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4173
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
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2742
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
2
1970
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.