MS SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsDatabasesMS SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 14th, 2003, 09:05 AM
patbe patbe is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2002
Posts: 7 patbe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
query help needed

I have these tables:

level_logg
Level_Logg_Timestamp
Tank_ID<FK>

tank
Tank_ID
Pejl_ID<FK>

pejl
Pejl_ID
Pejl_Placement_ID<FK>
Customer_Number<FK>

pejl_placement
Pejl_Placement_ID
Placement_Name

customer
Customer_Number
Customer_Name

I'm trying to make a query the that I get the folowing result:

Pejl_ID
Customer_Name
Placement_Name
Level_Logg_Timestamp


I need some help to get this right, I have no problem gettting everything except the timestamp there I don't know how to do.

plz help

.patrik

Reply With Quote
  #2  
Old November 14th, 2003, 11:06 AM
jstrohofer jstrohofer is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Cincinnati, OH USA
Posts: 111 jstrohofer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 3 sec
Reputation Power: 10
You could post what you have so far... but basically from what I've read I would use something like this:

SELECT pejl.pejl_id, customer.customer_Name, pejl_placement.placement_Name, level_logg.level_logg_timestamp
FROM level_logg
INNER JOIN tank ON level_logg.tank_id = tank.tank_id
INNER JOIN pejl ON tank.pejl_id = pejl.pejl_id
INNER JOIN pejl_placement ON pejl.pejl_placement_id = pejl_placement.pejl_placement_id
INNER JOIN customer ON pejl.customer_number = customer.customer_number


It seems from what you wrote that this are all 1 to 1 relationships, I think. Try that.

Reply With Quote
  #3  
Old November 17th, 2003, 01:09 AM
patbe patbe is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2002
Posts: 7 patbe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
thx worked lika a charm! had been thinking a little wrong...

.p

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMS SQL Development > query help needed

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap