473,427 Members | 1,800 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,427 software developers and data experts.

How to Quiry Pivot 4 Tables

2
Dear Sir/Madam

Could you help to give me an example how to quiry pivot 4 tables as below:
Expand|Select|Wrap|Line Numbers
  1.  
  2. 1. tblCity(Cityid, cityName) 
  3.     1 Phnom Penh 
  4.     2 Siem Reap 
  5.     3 Sihanouk 
  6.  
  7. 2. tblHotel(HotelID, HotelName) 
  8.    1 City Angkor Hotel 
  9.    2 Phnom Penh Hotel 
  10.    3 Sihanouk Hotel 
  11.    4 New York Hotel 
  12.    5 Pacific Hotel 
  13.    6 Angkor Star Hotel 
  14.    7 Khemera Angkor Hotel 
  15.    8 Sokha beach Hotel 
  16.    9 Costle Hotel
  17.  
  18. 3. tblTourClass(TourClassid, TourClass) 
  19.    1 Deluxe Class 
  20.    2 Supperies Class 
  21.    3 Standard Class
  22.  
  23. 4. tblTourHotel(id, CityID, HotelID, TourClassID) 
  24.    1   1   2   1 
  25.    2   2   1   1 
  26.    3   3   3   1 
  27.    4   1   4   2 
  28.    5   1   5   3 
  29.    6   2   6   2 
  30.    7   2   7   3 
  31.    8   3   8   2 
  32.    9   3   9   3
  33.  
  34.  
and I want to display as below:

Expand|Select|Wrap|Line Numbers
  1. City Name   Deluxe Class     Superior           Standard
  2. Siem Reap   CityAngkor Hotel Angkor Star Hotel  Khemera Angkor Hotel
  3. Phnom Penh  Phnom Penh Hotel  New York Hotel    Pacific Hotel 
  4. Sihanouk    Sihanouk Hotel   Sokha beach Hotel  Costle Hotel
  5.  
  6.  
I'm waiting for your help.

many thanks
Kosal
Jul 8 '10 #1
2 1366
ck9663
2,878 Expert 2GB
Join them first, then PIVOT the sub-query. You're going to need a key that link all these 4 tables. From your sample, there seems to be no key that links them together.

Good Luck!!!

~~ CK
Jul 8 '10 #2
kosaly
2
ok thank for you advise.

Now we can solve.

http://stackoverflow.com/questions/3...pivot-4-tables
Jul 8 '10 #3

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

Similar topics

0
by: Prasad Patil | last post by:
Hi, I have created a report in excel, it uses Pivot tables. The excel has two sheets 1: Pivot ( Contains the Pivot Table) 2: Data (Data Requred to populate the pivot table I create an...
1
by: Clive Moss | last post by:
I am in the middle of writing a system for a client who has Access 2000 installed on 8 PC's I have Access 2002 and the system I have written relies on pivot tables to display results. I now find...
4
by: Del | last post by:
I need to create Pivot table in Excel from Access. Currently I run a query and output the data to an excel worksheet and create the pivots via automation. The issue I face is that the query may...
1
by: Johnny Meredith | last post by:
Dear All, I have an Access database that tracks the progress of income tax audits. When the taxing authorities make a change (an "Adjustment"), I record the pertinent information in the...
0
by: Rami | last post by:
Has any body tried using pivot tables in C# I am trying to achieve pivot table functionality ( Rendering Row fields / Column Fields / Data fields ) in C# with Excel 2003. I have complete data in one...
1
by: Jerome Ranch | last post by:
I consider myself an Excel PT wizard of sorts, but now I have a situation with so much infromationthat I need to categorize and summarize, that I will use access to manage it. Interestingly,...
0
by: Zlatko Matić | last post by:
I have experienced some problems with total operations (sum, min, max, avg etc) in pivot tables nad pivot charts in .mde. In .mdb I can activate any totals operation. on both notebook and desktop...
3
by: nikila | last post by:
Hi, I have to create excel pivot tables from vb.net. Already I am creating excel file using oledb connection. I want to use the same to create the excel pivot tables. Can anyone please help me...
1
by: STUFIX | last post by:
Hi all, I created a pivot table that allowed users to select certain customers from a drop down list and display the relevant data - it worked fine but has now stopped allowing them to do that. ...
1
by: mld01s | last post by:
I really need help!!! I dont know if its possible to share pivot tables, or see pivot tables in other machines that the one where the tables were created. This is what happens: I created a...
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
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
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
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...
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.