首页 \ 问答 \ 过滤条件(Filter where on condition)

过滤条件(Filter where on condition)

我有这张桌子

User        | SecretId | Status
warheat1990 |     NULL |    REV
warheat1990 |     NULL |    COM
warheat1990 |        1 |    REV
warheat1990 |        1 |    COM

我想过滤掉数据(Status = REV和SecretId IS NOT NULL合并),所以最终结果将是

User        | SecretId | Status
warheat1990 |     NULL |    REV
warheat1990 |     NULL |    COM
warheat1990 |        1 |    COM

我的查询

SELECT * FROM TABLE WHERE User = 'warheat1990' AND (Status <> 'REV' AND SecretId IS NULL)

但它不起作用,因为它只给我这条行。

User        | SecretId | Status
warheat1990 |     NULL |    COM

那么如何使用Status = REV排除数据,但仅当SecretId不为NULL时才排除数据

我觉得愚蠢,我无法弄清楚这个简单的案例。 任何帮助将不胜感激。


I have this table

User        | SecretId | Status
warheat1990 |     NULL |    REV
warheat1990 |     NULL |    COM
warheat1990 |        1 |    REV
warheat1990 |        1 |    COM

I want to filter out data with (Status = REV and SecretId IS NOT NULL combined) so the final result will be

User        | SecretId | Status
warheat1990 |     NULL |    REV
warheat1990 |     NULL |    COM
warheat1990 |        1 |    COM

My query

SELECT * FROM TABLE WHERE User = 'warheat1990' AND (Status <> 'REV' AND SecretId IS NULL)

but it's not working because it gives me only this ROW.

User        | SecretId | Status
warheat1990 |     NULL |    COM

So how do I exclude data with Status = REV but only if SecretId IS NOT NULL

I feel stupid that I can't figure out this simple case. Any help will be appreciated.


原文:https://stackoverflow.com/questions/36637954
更新时间:2021-12-21 15:12

最满意答案

也许只是尝试做:

$(window).scrollTop($('#results').offset().top);

http://jsfiddle.net/fuggetgk/

或者,如果你愿意,这里有插件为这种效果http://balupton.github.io/jquery-scrollto/


Maybe try to do simply:

$(window).scrollTop($('#results').offset().top);

http://jsfiddle.net/fuggetgk/

Or if You prefer, here is plugin for this effect http://balupton.github.io/jquery-scrollto/

相关问答

更多
  • 为此,您可以为动画命令设置回调函数,该命令将在滚动动画完成后执行。 例如: var body = $("html, body"); body.stop().animate({scrollTop:0}, 500, 'swing', function() { alert("Finished animating"); }); 在哪个警报代码中,您可以执行更多的JavaScript来添加进一步的动画。 此外,“摆动”是设置宽松。 查看http://api.jquery.com/animate/了解更多信息 ...
  • 您可以使用.animate() scrollTop属性,如下所示: $("html, body").animate({ scrollTop: "300px" }); You can just use .animate() the scrollTop property, like this: $("html, body").animate({ scrollTop: "300px" });
  • 还请包含jquery-ui.js以缓解效果。 然后你可以在语法中使用缓动效果.animate( properties [, duration ] [, easing ] [, complete ] ) 在你的例子中它将是 - $('body').animate({ scrollTop: top },1000,'easeOutElastic', function () { $prev.addClass('current'); }); Please also include jq ...
  • 您的滚动顶部无法正常工作,因为您必须添加“px”: $('.sectionlink').click(function(e){ var sectionelement = $(this).attr("rel"); var myoffset = $('#'+sectionelement).offset().top; $('html, body').animate({ scrollTop: myoffset+"p ...
  • 也许只是尝试做: $(window).scrollTop($('#results').offset().top); http://jsfiddle.net/fuggetgk/ 或者,如果你愿意,这里有插件为这种效果http://balupton.github.io/jquery-scrollto/ Maybe try to do simply: $(window).scrollTop($('#results').offset().top); http://jsfiddle.net/fuggetgk/ Or ...
  • 有时浏览器使用0px < val px < 1px 。 我的猜测是jquery动画滚动到一个值,例如。 window.scrollTop = 499.9 ,目的地为500 。 因此if( $(window).scrollTop() < v ){评估与之前相同。 要检查这个,你可以更换 $root.stop(true,true).animate({scrollTop: v},500); 同 $root.stop(true,true).animate({scrollTop: v},500, fu ...
  • 你可以为此使用animate() 。 应用于div示例代码如下所示: //Scroll to bottom $('div').animate({scrollTop: $('div').get(0).scrollHeight}, 3000); //$('div').get(0).scrollHeight - will give the full height of div. //scrollTop - will be used to animate from the current position to ...
  • 我的名字是Saucier(:在你的一段中 但至于你的问题,我能够用一些技巧来纠正这种情况。 第一个是我没有启动动画,直到imagePos <= topOfWindow ,这意味着手机的内容部分必须完全可见。 如果你想更改它以便更快地发生,请从imagePos减去 我改变的第二件事是你的主要问题所在。 在达到该点后,任何时候滚动窗口时,您的动画都会被触发。 为了解决这个问题,我添加了一个名为hasAnimated的布尔值来跟踪动画事件是否已经触发,并将所有动画放在依赖于该布尔值的if语句中。 if(!hasA ...
  • 试试这个...... $('.arrow-up').click(function(){ $('html, body').animate({scrollTop : 0},300); return false; }); Try with this.. $('.arrow-up').click(function(){ $('html, body').animate({scrollTop : 0},300); return false; });
  • 您需要相对于链接在元素中的位置以及相对于#boxMaster元素在#boxMaster元素中的top位置#boxMaster元素。 您可以通过将#boxMaster元素的scrollTop()值添加到其top位置,然后从链接的偏移top值中减去该值来执行此操作: $(this.hash).offset().top - $('#boxMaster').position().top + $('#boxMaster').scrollTop() 更新的示例 var $boxMaster = $('#boxMast ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)