Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unravelling a simple table

Status
Not open for further replies.

EnergyTed

Programmer
Joined
Jan 27, 2005
Messages
68
Location
GB
Hi

I have a simple table with two fields.

Field 1 - Meter ID, Field 2 - Sub Meter ID.

The table shows all the meter/sub meter links in an unknown amount of networks.

Some meter ids are repeated in field 1 to show all the sub meters linked to it. Some records are Subs of a sub meter and not a main meter.

Can anyone help to explain this out to show all linked meters in any/all individual networks.

Kind Regards
 
Assuming a meter can only be a submeter to one meter, change your table to:
MeterID, MotherMeterID

MeterID would be a primary key, so listed only once.
MotherMeterID would be the MeterID of its immediate parent.

Then using a self-join, you can find a meter and all its submeters.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top