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

Help with Database Design

759 512MB
Hi all !
I know. The thread title sound strange but...

This is the very simplified scenario:

I have 4 tables:
- House (ID_House, Address)
- Rooms (ID_Room, TypeOfRoom) 'Bathroom, Living room ...
- Bulbs (ID_Bulb, Power)
- Lights(ID_Light, ID_House, ID_Room, ID_Bulb)

A house can have any number of different rooms (even zero)
In a room can be any numbers of bulbs (even zero).
The room table is not "close": in time I can add (or delete) more type of rooms (but I can't delete a room IF it has a bulb).


I need a report like a table:

Row headers: ID_House
Column headers: ID_Room
Intersection: ID_Bulb (if a bulb exist; blank if it is not a bulb in that room)

If in a room there are two or more bulbs I need two or more rows with the same ID_House and ID_Room

How you solve that ?
It is possible to define such query ?

What about if the Room table is "fixed" ? I think must be easier to design the report but still I don't know "how to".

Thank you !
Oct 31 '11 #1
3 799
NeoPa
32,556 Expert Mod 16PB
You could probably use a Cross-Tab query, but not have multiple rows for multiple bulbs. Have a count instead.

Building reports is another matter. I'm not sure you can on a Cross-Tab query.
Nov 1 '11 #2
Rabbit
12,516 Expert Mod 8TB
You could use a cross-tab and group by the bulb but not bring it into the select clause. And you could use a max on the bulb.
Nov 1 '11 #3
Mihail
759 512MB
Thank you for replies !

So the cross-tab query sound as a solution.
I'll learn about.

Thank you again.
If you have more ideas let me know, please.
Nov 1 '11 #4

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

Similar topics

14
by: Jason Daly | last post by:
I'm a freshman at college as a computer science major. I'm not sure it has what I want. Does anyone know if a major commonly exists in web design (focusing in server side languages)? I want to...
4
by: Frank Einstein | last post by:
Looking for a tool that can edit an XML file in a browser. The basic requirement is that the XML file is rendered as an HTML form with editable fields (including add/delete, preferably in...
47
by: Neal | last post by:
Patrick Griffiths weighs in on the CSS vs table layout debate in his blog entry "Tables my ass" - http://www.htmldog.com/ptg/archives/000049.php . A quite good article.
2
by: Wayne Wengert | last post by:
I hope this is an appropriate group for this question? I work with a non-profit group that uses SQL Server 2000 for their data backend. They have a moderate size web site with many data driven...
4
by: Simon Cooke | last post by:
Hi there; A while back when I was in Albany, NY, I came across what looked like a really great C++ book for the experienced programmer. Unfortunately, I couldn't buy it and take it with me...
14
by: Salad | last post by:
On the computer side of the businees there is me, the developer. Another person's role is that of the idea man...the person that knows the business and requirements and issues for the business. ...
1
by: Johann Blake | last post by:
I am looking for a good solution on how to implement data access in an application so that there is a clean separation between the data access layer, the business layer and the GUI layer. I am...
1
by: marklinehan | last post by:
Hi, my name is Mark Linehan. About 20 years ago or so I started learning how to program on the Commodore 64 computer (anyone remember those?) heheheh. I taught myself basic on this little machine...
11
by: matsi.inc | last post by:
I am looking to make something like a delegate that i can use in my projects but am having a hard time getting started. The behavior I am most interested in is how a delegate changes it's Invoke...
6
by: beantaxi | last post by:
Hello all, I'm looking for a very simple code analysis tool. I have a large codebase to analyze, and all I really need to do is to find all uses of all methods in a few interfaces. Many tools...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...

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.