SQL Server:是从另一个表中获取列的列值为null

时间:2016-02-03 19:02:05

标签: sql sql-server

我有两张桌子。如果表A中的百分比为null,那么我想在表B中查找它

02-03 09:59:18.475 2566-2566/com.mycompany.mapsdemo E/AndroidRuntime: FATAL EXCEPTION: main
                                                                                  Process: com.mycompany.mapsdemo, PID: 2566
                                                                                  java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mycompany.mapsdemo/com.mycompany.mapsdemo.MapsActivity}: android.view.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class fragment
                                                                                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
                                                                                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
                                                                                      at android.app.ActivityThread.-wrap11(ActivityThread.java)
                                                                                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
                                                                                      at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                      at android.os.Looper.loop(Looper.java:148)
                                                                                      at android.app.ActivityThread.main(ActivityThread.java:5417)
                                                                                      at java.lang.reflect.Method.invoke(Native Method)
                                                                                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
                                                                                   Caused by: android.view.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class fragment
                                                                                      at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
                                                                                      at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
                                                                                      at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
                                                                                      at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:393)
                                                                                      at android.app.Activity.setContentView(Activity.java:2166)
                                                                                      at com.mycompany.mapsdemo.MapsActivity.onCreate(MapsActivity.java:21)
                                                                                      at android.app.Activity.performCreate(Activity.java:6237)
                                                                                      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
                                                                                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
                                                                                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
                                                                                      at android.app.ActivityThread.-wrap11(ActivityThread.java) 
                                                                                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
                                                                                      at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                                      at android.os.Looper.loop(Looper.java:148) 
                                                                                      at android.app.ActivityThread.main(ActivityThread.java:5417) 
                                                                                      at java.lang.reflect.Method.invoke(Native Method) 
                                                                                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
                                                                                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
                                                                                   Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class fragment
                                                                                      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:782)
                                                                                      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
                                                                                      at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
                                                                                      at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
                                                                                      at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
                                                                                      at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:393) 
                                                                                      at android.app.Activity.setContentView(Activity.java:2166) 
                                                                                      at com.mycompany.mapsdemo.MapsActivity.onCreate(MapsActivity.java:21) 
                                                                                      at android.app.Activity.performCreate(Activity.java:6237) 
                                                                                      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107) 
                                                                                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369) 
                                                                                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
                                                                                      at android.app.ActivityThread.-wrap11(ActivityThread.java) 
                                                                                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
                                                                                      at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                                      at android.os.Looper.loop(Looper.java:148) 
                                                                                      at android.app.ActivityThread.main(ActivityThread.java:5417) 
                                                                                      at java.lang.reflect.Method.invoke(Native Method) 
                                                                                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
                                                                                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
                                                                                   Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.io.File.mkdir()' on a null object reference
                                                                                      at com.google.maps.api.android.lib6.gmm6.m.ad.a(Unknown Source)
                                                                                      at com.google.maps.api.android.lib6.gmm6.c.h.a(Unknown Source)
                                                                                      at com.google.maps.api.android.lib6.gmm6.c.ao.a(Unknown Source)
                                                                                      at com.google.maps.api.android.lib6.e.bd.a(Unknown Source)
                                                                                      at com.google.maps.api.android.lib6.e.ev.a(Unknown Source)
                                                                                      at com.google.maps.api.android.lib6.e.z.a(Unknown Source)
                                                                                      at com.google.maps.api.android.lib6.e.y.a(Unknown Source)
                                                                                      at com.google.android.gms.maps.internal.u.onTransact(SourceFile:107)
                                                                                      at android.os.Binder.transact(Binder.java:387)
                                                                                      at com.google.android.gms.maps.internal.IMapFragmentDelegate$zza$zza.onCreateView(Unknown Source)
                                                                                      at com.google.android.gms.maps.SupportMapFragment$zza.onCreateView(Unknown Source)
                                                                                      at com.google.android.gms.dynamic.zza$4.zzb(Unknown Source)
                                                                                      at com.google.android.gms.dynamic.zza.zza(Unknown Source)
                                                                                      at com.google.android.gms.dynamic.zza.onCreateView(Unknown Source)
                                                                                      at com.google.android.gms.maps.SupportMapFragment.onCreateView(Unknown Source)
                                                                                      at android.support.v4.app.Fragment.performCreateView(Fragment.java:1962)
                                                                                      at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1036)
                                                                                      at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1226)
                                                                                      at android.support.v4.app.FragmentManagerImpl.addFragment(FragmentManager.java:1328)
                                                                                      at android.support.v4.app.FragmentManagerImpl.onCreateView(FragmentManager.java:2284)
                                                                                      at android.support.v4.app.FragmentController.onCreateView(FragmentController.java:111)
                                                                                      at android.support.v4.app.FragmentActivity.dispatchFragmentsOnCreateView(FragmentActivity.java:314)
                                                                                      at android.support.v4.app.BaseFragmentActivityHoneycomb.onCreateView(BaseFragmentActivityHoneycomb.java:31)
                                                                                      at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:79)
                                                                                    at android.view.LayoutInflater.

1 个答案:

答案 0 :(得分:1)

这应该这样做:

SELECT t.id, COALESCE(t.percentage, s.percentage) AS percentage
FROM project_percentage t
LEFT OUTER JOIN
test2 AS s
ON s.id = t.id;