|
|
select AgentCode,AgentName,Address,poskod.Postcode,negeri.City,State
from agent,alamat,poskod,negeri
where agent.AgentCode=alamat.Code
and alamat.Postcode=poskod.Postcode
and poskod.City=negeri.City order by agent.AgentCode
Result:
s100 xxx 123, jalan m 06150 ayer hitam johor
s100 xxx 123, jalan m 06150 ayer hitam kedah
请问要怎样让johor的那个不要show出来,因为他的poskod是不对的。 |
|
|
|
|
|
|
|
|
|
|
发表于 13-11-2010 12:26 AM
|
显示全部楼层
|
where poskod.City <> 'johor' |
|
|
|
|
|
|
|
|
|
|

楼主 |
发表于 13-11-2010 12:34 AM
|
显示全部楼层
回复 2# onlylonly
谢谢你。可是我还有show database里全部的data。
Example:
s100 xxx 123, jalan m, 06150 ayer hitam kedah
s101 yyy 456, taman k, 16800 pasir puteh kelantan
s102 zzz 789, jalan p, 81800 ulu tiram johor
所以这是行不通。 |
|
|
|
|
|
|
|
|
|
|
发表于 13-11-2010 12:42 AM
|
显示全部楼层
where poskod.City <> 'johor' AND poskod.Postcode <> '06150'
我不懂你的 postcode 是 string 还是 numeric。。 我把它当成是 string |
|
|
|
|
|
|
|
|
|
|

楼主 |
发表于 13-11-2010 11:04 AM
|
显示全部楼层
where poskod.City 'johor' AND poskod.Postcode '06150'
我不懂你的 postcode 是 string 还是 numeri ...
onlylonly 发表于 13-11-2010 12:42 AM 
我的postcode是string的。因为如果放numeric的话,06150就会变成了6150,对吗?你说放where poskod.City 'johor' AND poskod.Postcode '06150',这样的话,凡是有johor and 06150的就不会出来了,是吗?
对不起,我才刚学,所以有很多都不会,问的问题也会白痴一点。 |
|
|
|
|
|
|
|
|
|
|
发表于 13-11-2010 11:30 AM
|
显示全部楼层
本帖最后由 onlylonly 于 13-11-2010 11:35 AM 编辑
没错, 凡是同时poscode是 06150 与同时是 johor 都不会受出来。。
其实 numeric 也可以 06150 的, 比如说在 mysql
create table test (
poscode integer(5) ZEROFILL not null PRIMARY KEY );
INSERT INTO test(poscode) values(1234);
SELECT * from test;
你会发现
+---------+
| poscode |
+---------+
| 01234 |
+---------+ |
|
|
|
|
|
|
|
|
| |
本周最热论坛帖子
|