由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Database版 - how to write this query
相关主题
请问个join的问题mysql 问题 (转载)
SQL combine two tables into one table and add a new column新手请教SQL 语法问题- alias 和 join
请问这个query怎么做如何完成这个sql?
最近写了不少SQL script,请大牛评价下属于什么水平SQL question...
菜鸟问题,急Help: "Operation Must Be Updatable Query"
error of sql query in MS Access database (转载)向大牛请教 query问题啊!
怎样快速得到两个表的交集Error of SQL query on IBM netezza SQL database from Aginity (转载)
请教大虾问题哈,包子谢哈一个有关查询的语句
相关话题的讨论汇总
话题: query话题: table话题: select话题: where话题: write
进入Database版参与讨论
1 (共1页)
l********u
发帖数: 195
1
table 1
product no. description
001 aa
002 bb
003 cc
table 2
Product no transcaction
001 111
001 222
003 rrr
how can I write query to find the product in table 1 that doesn't have any
transaction in table 2. query should return 2 by using the above data.
R*********r
发帖数: 225
2
SELECT t1.ProductNumber FROM
Table1 t1
LEFT JOIN Table2 t2 ON
t2.ProductNumber = t1.ProductNumber
WHERE t2.ProductNumber IS NULL

【在 l********u 的大作中提到】
: table 1
: product no. description
: 001 aa
: 002 bb
: 003 cc
: table 2
: Product no transcaction
: 001 111
: 001 222
: 003 rrr

l********u
发帖数: 195
3
we need to put this query into a tool. however the tool has
"select * from table t1 where" hardcoded, left join is before where, so how
can I left join with query start with select * from where
B*****g
发帖数: 34098
4
not exists

how

【在 l********u 的大作中提到】
: we need to put this query into a tool. however the tool has
: "select * from table t1 where" hardcoded, left join is before where, so how
: can I left join with query start with select * from where

l********u
发帖数: 195
5
we need to put this query into a tool. however the tool has
"select * from table t1 where" hardcoded, left join is before where, so how
can I left join with query start with select * from where
l********u
发帖数: 195
6
beijing code pls. thanks

【在 B*****g 的大作中提到】
: not exists
:
: how

B*****g
发帖数: 34098
7
NOT EXSITS (SELECT 1 FROM table2 t2 WHERE t2.no = t.no)
or
no NOT IN (SELECT no FROM table2 t2)

【在 l********u 的大作中提到】
: beijing code pls. thanks
1 (共1页)
进入Database版参与讨论
相关主题
一个有关查询的语句菜鸟问题,急
How to Import a Datatable as fast as possible?error of sql query in MS Access database (转载)
Access 里面两个 column不一样的table 能combine 到一起吗?怎样快速得到两个表的交集
在没有Key的情况下,怎么update一个table的内容到另一个table?请教大虾问题哈,包子谢哈
请问个join的问题mysql 问题 (转载)
SQL combine two tables into one table and add a new column新手请教SQL 语法问题- alias 和 join
请问这个query怎么做如何完成这个sql?
最近写了不少SQL script,请大牛评价下属于什么水平SQL question...
相关话题的讨论汇总
话题: query话题: table话题: select话题: where话题: write