1. <i id='xI8z0'><tr id='xI8z0'><dt id='xI8z0'><q id='xI8z0'><span id='xI8z0'><b id='xI8z0'><form id='xI8z0'><ins id='xI8z0'></ins><ul id='xI8z0'></ul><sub id='xI8z0'></sub></form><legend id='xI8z0'></legend><bdo id='xI8z0'><pre id='xI8z0'><center id='xI8z0'></center></pre></bdo></b><th id='xI8z0'></th></span></q></dt></tr></i><div id='xI8z0'><tfoot id='xI8z0'></tfoot><dl id='xI8z0'><fieldset id='xI8z0'></fieldset></dl></div>

    <small id='xI8z0'></small><noframes id='xI8z0'>

        <bdo id='xI8z0'></bdo><ul id='xI8z0'></ul>

      <tfoot id='xI8z0'></tfoot>
      <legend id='xI8z0'><style id='xI8z0'><dir id='xI8z0'><q id='xI8z0'></q></dir></style></legend>

      sequelize, Statement(where) in statement(where)

      sequelize, Statement(where) in statement(where)(sequelize, Statement(where) in statement(where))

    1. <small id='1c02I'></small><noframes id='1c02I'>

          <bdo id='1c02I'></bdo><ul id='1c02I'></ul>
            <tbody id='1c02I'></tbody>
          <tfoot id='1c02I'></tfoot>
          <i id='1c02I'><tr id='1c02I'><dt id='1c02I'><q id='1c02I'><span id='1c02I'><b id='1c02I'><form id='1c02I'><ins id='1c02I'></ins><ul id='1c02I'></ul><sub id='1c02I'></sub></form><legend id='1c02I'></legend><bdo id='1c02I'><pre id='1c02I'><center id='1c02I'></center></pre></bdo></b><th id='1c02I'></th></span></q></dt></tr></i><div id='1c02I'><tfoot id='1c02I'></tfoot><dl id='1c02I'><fieldset id='1c02I'></fieldset></dl></div>

              1. <legend id='1c02I'><style id='1c02I'><dir id='1c02I'><q id='1c02I'></q></dir></style></legend>
              2. 本文介绍了sequelize, Statement(where) in statement(where)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我尝试了 2 个小时来解决一个不是问题的小问题.我正在使用生成的 yeoman Angular-fullstack 应用程序.

                I'm trying for 2 hours to resolve a little problem which is not one. I'm on an generated yeoman Angular-fullstack App.

                我想用 sequelize 写这段代码:

                I want to write this code with sequelize:

                SELECT * 
                FROM demand 
                WHERE city_id NOT IN (
                SELECT city_id
                FROM demand
                WHERE user_id=req.params.user_id)
                

                我还有以下代码,但这不起作用.我只得到 []

                I have yet the following code but that doesn't work. I get only []

                export function getCity(req, res) {
                  return Demand.findAll({
                    where: {
                      city_id:{ $notIn: Demand.findAll({
                        attributes: ['city_id'],
                        where: {
                          user_id: req.params.user_id,
                        }
                      })}
                    }
                  })
                  .then(handleEntityNotFound(res))
                  .then(respondWithResult(res))
                  .catch(handleError(res));
                }
                

                你有线索吗?谢谢.

                推荐答案

                我没有找到好的解决方案:我终于用查询写了.

                I have not found a nice solution: I have finally wrote with query.

                export function showDemandArtistNoUser(req, res) {
                  return db.sequelize.query('SELECT * FROM demands WHERE city_id NOT IN (SELECT city_id FROM demands WHERE user_id='+req.params.user_id+')', { type: db.sequelize.QueryTypes.SELECT })
                  .then(handleEntityNotFound(res))
                  .then(respondWithResult(res))
                  .catch(handleError(res));
                }
                

                而我的 angular-fullstack,我必须在我的页面上添加:

                And with my angular-fullstack, i have to add on my page:

                 import db from '../../sqldb';
                

                这篇关于sequelize, Statement(where) in statement(where)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Pause youtube video, youtube api(暂停 youtube 视频,youtube api)
                Youtube iframe api not triggering onYouTubeIframeAPIReady(Youtube iframe api 未触发 onYouTubeIframeAPIReady)
                How can I stop a video with Javascript in Youtube?(如何在 Youtube 中停止使用 Javascript 的视频?)
                How to call Greasemonkey#39;s GM_ functions from code that must run in the target page scope?(如何从必须在目标页面范围内运行的代码中调用 Greasemonkey 的 GM_ 函数?)
                How do you mute an embedded Youtube player?(如何使嵌入式 Youtube 播放器静音?)
                How to get number of video views with YouTube API?(如何使用 YouTube API 获取视频观看次数?)

                1. <small id='nERbo'></small><noframes id='nERbo'>

                    <i id='nERbo'><tr id='nERbo'><dt id='nERbo'><q id='nERbo'><span id='nERbo'><b id='nERbo'><form id='nERbo'><ins id='nERbo'></ins><ul id='nERbo'></ul><sub id='nERbo'></sub></form><legend id='nERbo'></legend><bdo id='nERbo'><pre id='nERbo'><center id='nERbo'></center></pre></bdo></b><th id='nERbo'></th></span></q></dt></tr></i><div id='nERbo'><tfoot id='nERbo'></tfoot><dl id='nERbo'><fieldset id='nERbo'></fieldset></dl></div>

                        <legend id='nERbo'><style id='nERbo'><dir id='nERbo'><q id='nERbo'></q></dir></style></legend>

                        <tfoot id='nERbo'></tfoot>
                          <tbody id='nERbo'></tbody>
                          <bdo id='nERbo'></bdo><ul id='nERbo'></ul>