MySQL不选择具有给定ID的行

编程入门 行业动态 更新时间:2024-10-23 14:26:27
本文介绍了MySQL不选择具有给定ID的行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有两个表,一个气候"表和一个有利作物"表.我想使用此查询为特定位置选择所有有利作物,但它只选择所有内容而不管指定的id"

I have two tables, a 'climates' table and a 'favourablecrops' table. I want to select all the favourable crops for a particular location using this query but it just selects everything regardless of the specified 'id'

SELECT tbl_climatic.location, tbl_favourablecrops.favCrop FROM tbl_climatic, tbl_favourablecrops WHERE tbl_climatic._id=tbl_favourablecrops.location_id=0

请帮忙

推荐答案

使用标准 join 和适当的 where 条件:

Use a standard join with appropriate where criteria:

SELECT tbl_climatic.location, tbl_favourablecrops.favCrop FROM tbl_climatic join tbl_favourablecrops on tbl_climatic._id=tbl_favourablecrops.location_id WHERE tbl_favourablecrops.location_id=0

更多推荐

MySQL不选择具有给定ID的行

本文发布于:2023-10-14 21:56:20,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1492327.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:MySQL   ID

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!