Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Summing by location
Message
From
27/07/1999 11:53:45
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00246115
Message ID:
00246667
Views:
12
To get what you want, I think you might need a third table to define the locations. You have Master and OnHand right now, but unless I totally mis-understand, you want to get a master record for each possible location? Even if there isn't a record in onhand to begin with? What if there are 20 different locations, and the part can only be at three of them?

I dunno. At any rate, try a locations table in the mix, and see where that gets you.

>Actually, I understand what you're saying, but if I'm getting SQL correct on a join the circles aren't always parent on left, child on right, instead, a left join says that parent is on left, a right join says that the parent is on right...but I tried both right and left joins and I still don't get what I'm looking for:(
>
>
>>Set theory (I'm not strong on it) but visualize your data as sets of dots with circles around them. The two circles overlap. On the left side is your master table, on the right side is your child table. A right join says, "Give me every child, matching parent where you can, and provide blank partents where you can't match" a left join says, "Give me every master and matching every child where you can, and giving me blank children where you can't match"
>>
>>Maybe I didn't read the problem correctly, but I think you need a left join.
>>
>
>>>>>Here again is the statement I have thus far:
>>>>>
SELECT INMAST.FPARTNO, INONHD.FONHND ;
>>>>>	FROM INONHD RIGHT JOIN INMAST;
>>>>>	ON INONHD.FPARTNO=INMAST.FPARTNO;
>>>>>	WHERE &LCWHERE;
>>>>>	INTO CURSOR TMP1
>>>>>LCWHERE is concatenated according to other conditions within the form...is there a way to put like an IIF() like this?
>>>>>
SELECT INMAST.FPARTNO,IIF(EMPTY(INONHD.FONHND),'0' AS FONHND,INONHD.FONHND)...
>>>>>I've tried the above and it keeps giving me an error when the SQL is executed that it needs a )....got any ideas?
--Todd Sherman
-Wake Up! Smell the Coffee!
Previous
Reply
Map
View

Click here to load this message in the networking platform