使用where子句获取所有结果 [英] Getting all results using where clause

查看:87
本文介绍了使用where子句获取所有结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个函数,该函数接受在whe​​re子句中使用的参数

I have a function which takes an argument that is used in where clause

function(string x)->现在这将创建一个提供

function(string x)-->Now this will create a sql query which gives

select colname from tablename where columnname=x;

现在,我希望此函数提供所有行,即等于

Now I want this function to give all rows i.e. query equivalent to

select colname from tablename;

当我传递x ="All"时.

when I pass x="All".

我想创建一个通用查询,当我传递全部"时,它应该返回我所有其他行,以过滤我的结果.

I want to create a generic query that when I pass "All" then it should return me all the rows else filter my result.

推荐答案

只需将where条件排除在外.

Just leave the where condition out.

如果您真的想要它那么复杂的用途

If you really want it that complicated use

where columnname LIKE '%'

仅将过滤空值.

这篇关于使用where子句获取所有结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆