Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Sat Dec 15, 2018 1:50 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Seems to easy but for some reason two table query isn't
PostPosted: Fri Mar 22, 2013 5:54 pm 
Offline

Joined: Fri Sep 14, 2007 5:00 pm
Posts: 408
So I have two tables I want to query from. The first table has multiple records that occur with a common key called metId. The second table has only one instance of each metId.

Example:
tblHist will have a meter id multiple times (there are other fields but this is the foreign key)
tblMetDet will have meter id only once.

Now there is a specific field in tblMetDet that identifies what type of meter a record contains. I want to select the associated historical records based on that identity. And here is where I am getting confused.


Top
 Profile  
Reply with quote  
 Post subject: Re: Seems to easy but for some reason two table query isn't
PostPosted: Fri Mar 22, 2013 6:27 pm 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
select tblHist.*, tblMetDet.MeterType from tlbHist
left join tblMetDet on tblMetDet.ID = tblHist.metID
where ...


Top
 Profile  
Reply with quote  
 Post subject: Re: Seems to easy but for some reason two table query isn't
PostPosted: Sat Mar 23, 2013 9:32 am 
Offline
User avatar

Joined: Fri Sep 30, 2005 11:48 am
Posts: 3554
Location: Lenexa, KS
If you are not very strong in SQL, this is a case where a graphical query editor can be helpful. I've used the db editor Navicat (they have versions for SQLite, MySQL, PostgreSQL and even MS SQL Server) for years to help create complex queries. Once you get the hang of the simple queries they're not so hard any more.

_________________
Bob K.

A blog about being a Real Studio/Xojo developer at http://www.bkeeneybriefs.com


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group