看起来这应该很容易,但...... [英] seems like this should be easy but...

查看:86
本文介绍了看起来这应该很容易,但......的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的表:


+ ------ + ---------------- + ----- - + ------- + ------- +

|制作|型号| fyear | lyear | id |

+ ------ + ---------------- + ------- + ------- + ------- +

| JEEP | CHEROKEE | 1988年| 2002 | 0J723 |

| JEEP | CJ-7 | 1986年| 1986年| 0J712 |

| JEEP | SCRAMBLER | 1976年| 1985年| 0J711 |

| JEEP | COMANCHE | 1986年| 1992年| 0J830 |

| JEEP | GRAND CHEROKEE | 1993年| 2002 | 0J731 |

| JEEP | GRAND WAGONEER | 1972年| 1991年| 0J742 |

| JEEP | PICKUP | 1979年| 1988年| 0J812 |

| JEEP |牧羊人| 1987年| 2002 | 0J713 |

+ ------ + ---------------- + ------- + ------- + ------- +


这是我想要的查询返回:所有可用模型的列表

介于1976年和1987年之间。


这是我应该得到的:

CJ-7

SCRAMBLER

COMANCHE

GRAND WAGONEER

PICKUP

牧羊人


我如何说出选择陈述?


谢谢

Bob

解决方案

Bob Van Der Ploeg写道:
< blockquote class =post_quotes>以下是我想要返回的查询:1976年到1987年之间所有可用模型的列表。
我如何表达select语句?




这不行吗?


从tablename中选择模型,其中fyear> = 1976和lyear< = 1987;


Bob Van Der Ploeg写道:

这是我想要的他要求返回:1976年到1987年之间可用的所有模型列表。
如何用短语表示选择语句?




Doesn'这项工作是什么?


从tablename中选择模型,其中fyear> = 1976和lyear< = 1987;


Nope ...返回:


mysql>从make中选择模型make =" jeep"和fyear> = 1976和lyear

< = 1987;

+ ----------- +

|型号|

+ ----------- +

| CJ-7 |

| SCRAMBLER |

+ ----------- +

2行套装(0.00秒)


我试过......感谢你玩...... :)


其他人?

" Aggro" < SP ********** @ yahoo.com>在消息中写道

news:%x *********** @ read3.inet.fi ...

Bob Van Der Ploeg写道:

以下是我想要返回的查询:1976年到1987年之间所有可用模型的列表。


我如何说出select语句?



这不行吗?

从tablename中选择模型,其中fyear> = 1976和lyear< ; = 1987;



Here is my table:

+------+----------------+-------+-------+-------+
| make | model | fyear | lyear | id |
+------+----------------+-------+-------+-------+
| JEEP | CHEROKEE | 1988 | 2002 | 0J723 |
| JEEP | CJ-7 | 1986 | 1986 | 0J712 |
| JEEP | SCRAMBLER | 1976 | 1985 | 0J711 |
| JEEP | COMANCHE | 1986 | 1992 | 0J830 |
| JEEP | GRAND CHEROKEE | 1993 | 2002 | 0J731 |
| JEEP | GRAND WAGONEER | 1972 | 1991 | 0J742 |
| JEEP | PICKUP | 1979 | 1988 | 0J812 |
| JEEP | WRANGLER | 1987 | 2002 | 0J713 |
+------+----------------+-------+-------+-------+

Here is what I want the query to return: A list of all models available
between 1976 and 1987.

Here is what I SHOULD get:
CJ-7
SCRAMBLER
COMANCHE
GRAND WAGONEER
PICKUP
WRANGLER

How would I phrase the select statement?

Thanks
Bob

解决方案

Bob Van Der Ploeg wrote:

Here is what I want the query to return: A list of all models available
between 1976 and 1987. How would I phrase the select statement?



Doesn''t this work?

select model from tablename where fyear >= 1976 and lyear <= 1987;


Bob Van Der Ploeg wrote:

Here is what I want the query to return: A list of all models available
between 1976 and 1987. How would I phrase the select statement?



Doesn''t this work?

select model from tablename where fyear >= 1976 and lyear <= 1987;


Nope... That returns:

mysql> select model from make where make="jeep" and fyear >= 1976 and lyear
<= 1987;
+-----------+
| model |
+-----------+
| CJ-7 |
| SCRAMBLER |
+-----------+
2 rows in set (0.00 sec)

I tried that... Thanks for playing... :)

anyone else?
"Aggro" <sp**********@yahoo.com> wrote in message
news:%x***********@read3.inet.fi...

Bob Van Der Ploeg wrote:

Here is what I want the query to return: A list of all models available
between 1976 and 1987.


How would I phrase the select statement?



Doesn''t this work?

select model from tablename where fyear >= 1976 and lyear <= 1987;



这篇关于看起来这应该很容易,但......的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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