Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

LEFT OUTER JOIN not working?

Featured Replies

This looks simple and correct to me yet in this case, FM will not return the null value for a value A6 on the left. 

Here is the example SQL

SELECT 
	"sach"."AchievementNumber",  
	COUNT("searned"."_scout") 
	
FROM "sach" 
	LEFT OUTER JOIN "searned" 
	ON "sach"."_id" = "searned"."_achievement" 		
	
WHERE 
	"searned"."_scout" = ? 
	and "isRegularAchivement" = 1  		
	
GROUP BY "sach"."AchievementNumber" 		
ORDER BY "sach"."AchievementNumber" 		

 

I should get 12 rows every time, yet this is all I get:

 

A1,6
A2,8
A3,3
A4,7
A5,10
A7,4
A8,2
A9,5
A10,3
A11,4
A12,5
 
if I run this
SELECT DISTINCT( ''||"AchievementNumber" ), "requiredAchievements" FROM "sach" WHERE "isRegularAchivement" = ? ORDER BY "AchievementNumber"

 

 

A1,6
A2,7
A3,3
A4,6
A5,5
A6,3
A7,6
A8,5
A9,5
A10,3
A11,4
A12,5
 
Why won't FM properly return a null for the missing rows for A6?

 

That's what the OUTER JOIN does. Think of it as parent records with child portal rows. The parents will all be returned even if the portal is empty (no related children). However, if you make implied JOIN, does it return 0 count on empty children?

FROM sach, searned

WHERE sach.id = searned."_achievement"

COUNT() is looking for NOT NULL, so I doubt you'd get what you want that way as well. Perhaps you need a CASE to test and return 0 when there are no children?

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.