如果我的问题看起来很奇怪,我很抱歉,希望当我解释它时,这将是可以理解的......
我有这个选择陈述
select
cax.CustomerID,
cax.AddressID,
c.YearBuilt,
a.Line1,
a.Line2,
a.City,
a.ZipCode,
a.StateID,
a.SubDivision,
s.Directions
from [CustomerAddressXREF] cax
inner join [Customer] c on c.CustomerID = cax.CustomerID
inner join [Address] a on a.AddressID = cax.AddressID
inner join [SubDivision] s on s.SubDivisionName = a.SubDivision
where cax.CustomerID = 11
我知道问题出现在SubDivision列中。如果我注释掉了.SubDivision和s.Directions,那么我会返回1行,这应该基于该语句。我想做的是如果a.SubDivision = N / A,那么我不想将它包含在查询或s.Directions中。
我不知道从哪里开始或从哪里开始关闭它。是否有可能做我想做的事
修改
我正在寻找的结果就是这个
因此,如果SubDivision列包含N / A,则它不会选择SubDivision或Directions
答案 0 :(得分:4)
目前尚不清楚你想要归还的结果,所以我们只是在猜测。
根据规范,省略c3p0
和mchange-commons-java
的值,并用NULL值替换它们......
改变这个:
private static Retrofit retrofit = null;
private static final String CACHE_CONTROL = "Cache-Control";
public static Retrofit getClient(Context context)
{
if (retrofit==null) {
retrofit = new Retrofit.Builder()
.baseUrl(URLS.BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.client(provideOkHttpClient(context))
.build();
}
return retrofit;
}
/**
* Add Client for adding Authentication headers.
* @return Retrofit
*/
public static Retrofit getAthenticationClient()
{
if (retrofit==null) {
retrofit = new Retrofit.Builder()
.baseUrl(URLS.BASE_URL)
.client(ApiIntercepters.AddAuthenticationHeader())
.addConverterFactory(GsonConverterFactory.create())
.build();
}
return retrofit;
}
public static OkHttpClient provideOkHttpClient(Context context)
{
return new OkHttpClient.Builder()
.addNetworkInterceptor(provideCacheInterceptor())
.cache( provideCache(context))
.build();
}
private static Cache provideCache (Context context)
{
Cache cache = null;
try
{
//setup cache
File httpCacheDirectory = new File(context.getCacheDir(), "responses");
int cacheSize = 10 * 1024 * 1024; // 10 MiB
cache = new Cache(httpCacheDirectory, cacheSize);
}
catch (Exception e)
{
Log.e( "Injector :-> ", "Could not create Cache!" );
}
return cache;
}
public static Interceptor provideCacheInterceptor ()
{
return new Interceptor()
{
@Override
public Response intercept (Chain chain) throws IOException
{
Response originalResponse = chain.proceed(chain.request());
if (RetrofitDemoApp.hasNetwork()) {
int maxAge = 60; // read from cache for 1 minute
return originalResponse.newBuilder()
.header("Cache-Control", "public, max-age=" + maxAge)
.build();
} else {
int maxStale = 60 * 60 * 24 * 28; // tolerate 4-weeks stale
return originalResponse.newBuilder()
.header("Cache-Control", "public, only-if-cached, max-stale=" + maxStale)
.build();
}
}
};
}
对此:
a.SubDivision
或对此(略有不同但等效):
a.Directions