Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do I get all records from left join in this Select -
Message
From
06/04/2000 07:08:01
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00355646
Message ID:
00356176
Views:
20
>>CREATE SQL VIEW CALLBACK AS ;
>>>SELECT ALL Servcalls.*, Customers.company;
>>> FROM appdata!servcalls LEFT JOIN appdata!customers ;
>>> ON Servcalls.prim_key = Customers.prim_key ;
>>> GROUP BY Servcalls.prim_key;
>>> ORDER BY Servcalls.callbacktime
>>
>>
>>Hi James,
>>
>>Does your table 'Servcalls' have lots of records but only two distinct customer id's ?
>>
>>If so, remove the GROUP BY clause from the SELECT and run it. Ideally, you should be running a GROUP BY expression only if there is an aggregate field in your SELECT statement. There does'nt seem to be one.
>>
>>I know Philip Pastor mentioned that, but his SELECT statement had an INNER JOIN which would exclude all record id's (if there are others) which do not have a corresponding record in Servcalls; Servcalls being the child table.
>>
>>Hope it helps.
>
>Thanks Sanjay
>
>Removing the "GROUP BY" did work. However, I'm about to give up on views to populate a grid in favor of cursors.
>
>I'm using about 4 grids on separate page frames, each filtered to show different information from the same table.
>
>When using views - to requery the view, I have to re-use it or (recreate it, which seems to create another table) and neither method repopulates my grids.
>
>Do you have any suggestions as to the use of Views Vs Cursors from local tables? Which is best when?
>
>Thanks again,
>-Curtis (I work for Jim)


Curtis,
You could use views or plain SQL cursors to populate grids. However if buffering wouldn't be a problem there are faster easier ways. Use your table again in DE with different aliases. In each of "child" grids (subsets) set linkmaster, childorder and relationalexpr properties. Set order of "child" aliases to the ones that link to master. This relieves you from overhead of requeries. You could even just "set key" instead of setting linkmaster, childorder, relationalexpr properties.
Cetin
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform