首页 \ 问答 \ 复杂的Yii SQL语句(Complex Yii SQL statement)

复杂的Yii SQL语句(Complex Yii SQL statement)

我是Yii的新手,我很难将SQL查询转换为Yii Active Record语言或使用查询构建器。

我有3个表: - 帖子:id,text - 标签:id,name - Post_Tag:id_post,id_tag

我想要做的是能够选择具有用户选择的所有标签的帖子:这是有效的SQL语句,我想翻译成Yii语言:

SELECT * FROM Post p INNER JOIN tags pt ON p.id=pt.post_id WHERE pt.tag_id in(10, 13) group by pt.post_id having count(distinct pt.tag_id) > 1;

有人有事要帮助我吗? 提前致谢 !


I'm new to Yii and I have difficulties to translate an SQL query to Yii Active Record language or with the query builder.

I have 3 tables : - Post : id, text - Tag : id, name - Post_Tag : id_post, id_tag

What i want to do is to be able to select the posts that have all tags selected by the user : Here is the SQL statement that works and that i want to translate to Yii language :

SELECT * FROM Post p INNER JOIN tags pt ON p.id=pt.post_id WHERE pt.tag_id in(10, 13) group by pt.post_id having count(distinct pt.tag_id) > 1;

Is someone got something to help me ? thanks in advance !


原文:https://stackoverflow.com/questions/16921487
更新时间:2022-01-14 12:01

最满意答案

考虑到像Amazon.com这样的网站没有使用比Verisign所谓的“Secure Site Pro”更好的东西(亚马逊没有绿色栏 )。 也许如果你的公司规模很小,你就从事电子商务,你需要获得所有额外的可信度 - 然后去寻找更好的东西。 但说实话,我怀疑大多数冲浪者都不太关注绿色酒吧。 如果你没有将它用于电子商务,那么你真的可以选择较低的证书。


Consider that a site like Amazon.com is not using anything better than what Verisign is calling "Secure Site Pro" (Amazon does not have the green bar). Perhaps if your company is quite small, you are engaged in e-commerce, and you need all the extra credibility you can get - then go for something better. But honestly, I suspect most surfers have little regard for the green bar. And if you are not using this for e-commerce, then you really could go with the lesser certs.

相关问答

更多
  • 这完全是关于信任。 Verisign是一个比GoDaddy更受尊敬的权威,所以他们要求更高的价格。 此外,Verisign验证您的组织的合法性,而GoDaddy只验证您对该域的所有权。 It's all about trust. Verisign is a more highly-regarded authority than GoDaddy, so they command a higher price. Furthermore, Verisign verify the legitimacy of you ...
  • 证书的价值主要来自互联网用户在证书颁发者的信任。 为此,Verisign很难击败。 证书向客户说,您是您所说的,发行人已经验证了这一点。 您可以获得免费的SSL证书,例如由StartSSL签名。 这是对自签名证书的改进,因为您的最终用户将停止收到警告弹出窗口,通知他们您的可疑证书。 但是,通过https与您的站点通信时,浏览器栏不会变绿,因此此解决方案不理想。 最便宜的SSL证书,将绿色条款花费您几百美元,您需要通过提交相关文件,通过向公司的身份证明您的公司身份的过程。 The value of the c ...
  • 是的,它会工作并在浏览器中显示没有错误。 例如,如果您使用其SSL证书包含Google字体(通过例如https://fonts.googleapis.com )或Bing地图,则也是如此。 应该没有问题。 Yes, it will work and show no error in the browser. It's the same if you for example include Google Fonts (via e.g. https://fonts.googleapis.com) or Bing ...
  • 考虑到像Amazon.com这样的网站没有使用比Verisign所谓的“Secure Site Pro”更好的东西(亚马逊没有绿色栏 )。 也许如果你的公司规模很小,你就从事电子商务,你需要获得所有额外的可信度 - 然后去寻找更好的东西。 但说实话,我怀疑大多数冲浪者都不太关注绿色酒吧。 如果你没有将它用于电子商务,那么你真的可以选择较低的证书。 Consider that a site like Amazon.com is not using anything better than what Veris ...
  • 如果我没有错,最终实体证书的私钥(由Verisign等可信CA颁发的证书)用于解密客户端发送的信息 你错了。 事实并非如此。 对等方自己的私钥用于签署证书,以便客户端可以验证对等方拥有他提供的证书,签名证书的私钥用于,错误,签署证书。 If I am not wrong, the private key of an End Entity certificate (certificate issued by trusted CA like Verisign) is used to decrypt the in ...
  • 服务器将相同的链证书发送到firefox和s_client: CN = .s3.amazonaws.com SAN = DNS: .s3.amazonaws.com,DNS:s3.amazonaws.com CN = VeriSign Class 3安全服务器CA - G3 CN = VeriSign Class 3公共主要证书颁发机构 - G5 但验证证书的方式因SSL堆栈和客户端的受信任根证书而异。 如果是curl,你会遇到一个旧的OpenSSL验证问题。 细节: Firefox拥有一个受信任的根证书, ...
  • 是。 作为文档建议,您需要将其添加到信任库。 Yes. As the documentation advices, you need to add it to the trust store.
  • 证书#3不是VeriSign颁发的证书的一部分。 它可以是从节点复制的不完整请求的伪证书(在证书MMC中)。 如果是#2和#3证书的情况(比较公钥或Subject Key Identifier扩展值)。 如果匹配,请将证书#3移至“ Certificate Enrollment Requests节点。 您的客户需要做的是转到生成原始请求的计算机(我怀疑在IIS服务器上)并尝试通过运行以下命令正确安装已颁发的证书: certreq -accept path\certNo2.cer 如果命令成功,证书将自动安 ...
  • 对于任何有类似问题的人来说,问题不在于使用哪种SSL证书,而是要确保使用正确的协议。 顺便说一下,我最初使用cURL提供的curl-ca-bundle.crt。 此证书与对EppLib.net项目的目标.net框架的更改相结合解决了我的问题。 在从Github克隆时,目标是.net 4.0,Nominet至少需要TLS1.1,这在v4中是不可用的。 因此,我还将EppLib.net项目的目标更新为4.5.1并更改了SslProtocol SslProtocol.Tls to SslProtocol.Tls1 ...
  • 没有进一步的代码,我无法分辨,但是,我可以看到你加载受信任的证书,但你在哪里加载你自己的密钥库? 如果是在其他代码中,我无法分辨。 当您尝试使用外部Truststore时会发生什么,例如$ JAVA_HOME / jre / lib / security / cacerts 假设您确实想要使用动态信任存储(通常它们非常静态),请查看 http://jcalcote.wordpress.com/2010/06/22/managing-a-dynamic-java-trust-store/ Without fu ...

相关文章

更多

最新问答

更多
  • 如何在Laravel 5.2中使用paginate与关系?(How to use paginate with relationships in Laravel 5.2?)
  • linux的常用命令干什么用的
  • 由于有四个新控制器,Auth刀片是否有任何变化?(Are there any changes in Auth blades due to four new controllers?)
  • 如何交换返回集中的行?(How to swap rows in a return set?)
  • 在ios 7中的UITableView部分周围绘制边界线(draw borderline around UITableView section in ios 7)
  • 使用Boost.Spirit Qi和Lex时的空白队长(Whitespace skipper when using Boost.Spirit Qi and Lex)
  • Java中的不可变类(Immutable class in Java)
  • WordPress发布查询(WordPress post query)
  • 如何在关系数据库中存储与IPv6兼容的地址(How to store IPv6-compatible address in a relational database)
  • 是否可以检查对象值的条件并返回密钥?(Is it possible to check the condition of a value of an object and JUST return the key?)
  • GEP分段错误LLVM C ++ API(GEP segmentation fault LLVM C++ API)
  • 绑定属性设置器未被调用(Bound Property Setter not getting Called)
  • linux ubuntu14.04版没有那个文件或目录
  • 如何使用JSF EL表达式在param中迭代变量(How to iterate over variable in param using JSF EL expression)
  • 是否有可能在WPF中的一个单独的进程中隔离一些控件?(Is it possible to isolate some controls in a separate process in WPF?)
  • 使用Python 2.7的MSI安装的默认安装目录是什么?(What is the default installation directory with an MSI install of Python 2.7?)
  • 寻求多次出现的表达式(Seeking for more than one occurrence of an expression)
  • ckeditor config.protectedSource不适用于editor.insertHtml上的html元素属性(ckeditor config.protectedSource dont work for html element attributes on editor.insertHtml)
  • linux只知道文件名,不知道在哪个目录,怎么找到文件所在目录
  • Actionscript:检查字符串是否包含域或子域(Actionscript: check if string contains domain or subdomain)
  • 将CouchDB与AJAX一起使用是否安全?(Is it safe to use CouchDB with AJAX?)
  • 懒惰地初始化AutoMapper(Lazily initializing AutoMapper)
  • 使用hasclass为多个div与一个按钮问题(using hasclass for multiple divs with one button Problems)
  • Windows Phone 7:检查资源是否存在(Windows Phone 7: Check If Resource Exists)
  • 无法在新线程中从FREContext调用getActivity()?(Can't call getActivity() from FREContext in a new thread?)
  • 在Alpine上升级到postgres96(/ usr / bin / pg_dump:没有这样的文件或目录)(Upgrade to postgres96 on Alpine (/usr/bin/pg_dump: No such file or directory))
  • 如何按部门显示报告(How to display a report by Department wise)
  • Facebook墙贴在需要访问令牌密钥后无法正常工作(Facebook wall post not working after access token key required)
  • Javascript - 如何在不擦除输入的情况下更改标签的innerText(Javascript - how to change innerText of label while not wiping out the input)
  • WooCommerce / WordPress - 不显示具有特定标题的产品(WooCommerce/WordPress - Products with specific titles are not displayed)