有2个table,
tableA{id:int,...} 和tableB{id:int,name:text tags:int[]}
怎么通过 tableB 的name找到相关的tableA中的id我的想法是这样的,
SELECT a.id
FROM tableA a, tableB b
where b.name ='a name'
and b.tags@> {a.id} ;//但是这里不知道该怎么写
//b.tags@>'{12334}'这样没错,但是'{a.id}'就不是integer了
在线等待...
tableA{id:int,...} 和tableB{id:int,name:text tags:int[]}
怎么通过 tableB 的name找到相关的tableA中的id我的想法是这样的,
SELECT a.id
FROM tableA a, tableB b
where b.name ='a name'
and b.tags@> {a.id} ;//但是这里不知道该怎么写
//b.tags@>'{12334}'这样没错,但是'{a.id}'就不是integer了
在线等待...
解决方案 »
- 关于mysql事务死锁的疑问
- MySQL替换字符串的问题
- 请问为什么我查询这个执行为空呢?
- 一个很难的mysql存储过程,你会写吗???
- mysql event schedule问题
- 我正在学习的开源系统:Linux/Apache/Mysql/Ruby/Eclipse
- 后台数据库设计,大家帮忙讨论下····
- mysql绿色版6的使用
- 这个是什么错误呢,设置外键时显示ERROR 1022: Can't write; duplicate key in table '#sql-434_2'
- 为什么我开了天网防火墙后连不上mysql
- MYSQL 查询速度 求大家帮忙看看
- PostgreSQL及EnterpriseDB发起人Bruce Momjian中国技术交流会
(
id integer NOT NULL,
lat integer NOT NULL,
lon integer NOT NULL,
tags text[],
CONSTRAINT planet_osm_nodes_pkey PRIMARY KEY (id)
)CREATE TABLE planet_osm_ways
(
id integer NOT NULL,
nodes integer[] NOT NULL,//包含planet_osm_nodes中id的array
tags text[],
pending boolean NOT NULL,
CONSTRAINT planet_osm_ways_pkey PRIMARY KEY (id)
)
连接起来
@> : contains ARRAY[1,4,3] @> ARRAY[3,1]
要求2边都是array而我的数据一边是array一边是integer
from planet_osm_nodes a , planet_osm_ways b
where a.id = ALL (b.nodes)