Help with SQL

Join Date
Jan 2003
Location
Michigan
Posts
490
I know this is a little bit of a push for this forum, but sql is used a lot with hmis, so I figured id give it a shot.

I have the following tables.

OCDIST
INMAST

Currently I have a sql statment that only looks at ocdist.

SELECT ocdist.fpartno, ocdist.fcpartrev, ocidst.fcomment;
FROM ocdist;
WHERE ;
ORDER BY ;
INTO CURSOR Rpoctg
So I get...

Part x, 000, comment
Part y, 000 comment
Part z, 001 comment
, 000 comment

etc

I need the fDesciption field included from table INMAST.
Inmast has the fpartno as well. Id like this select statment
to pull the data with the descpition from inmast so I get

Part x, 000, comment, Desciption x
Part y, 000, comment, Desciption y, etc.

Ive tried

SELECT ocdist.fpartno, ocdist.fcpartrev, fcomment, inmast.fdesciption;
FROM ocdist inmast;
WHERE ocdist.fpartno == inmast.fpartno;
ORDER BY ;
INTO CURSOR Rpoctg
But it doesnt give me what I want, as it drops the occasional item that does not have a part number
Ive also tried using joins to no avail. This seems so simple. Can anyone give me some pointers? Thanks

matt
 
This is probably closer to what you are looking for:


SELECT ocdist.fpartno, ocdist.fcpartrev, ocdist.fcomment, inmast.fdescription
FROM inmast RIGHT OUTER JOIN
ocdist ON inmast.fpartno = ocdist.fpartno
 

Similar Topics

Hi everyone! there's a customer requirement for a report in excel format and they already have a template for the report... I have set up data...
Replies
27
Views
4,494
Got a 1200P HMI running Windows XP. The client has an alarm history that is using SQL 2005. Is there a simple way to obtain this alarm history in...
Replies
0
Views
1,054
I've been working on a fairly large project for the last couple months and have come to a road block for the last week. I've spent countless...
Replies
7
Views
7,112
Bonjour, I have been working with Historian SE for first time, and I have been having some problems connecting the historian instance with my sql...
Replies
10
Views
7,834
Hi all, Having a little trouble getting the result I require, I'm close but no cigar. Basically, I am wanting to display a table within the...
Replies
2
Views
3,930
Back
Top Bottom