由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Database版 - Rookie's question again
相关主题
SQL combine two tables into one table and add a new columnSQL add some columns into a table from another table (转载
SQL copy a table into a new table and add a new column[转载] 问个SQL问题
新手请教SQL 语法问题- alias 和 joinone question on SQL
问个SQL问题- partial outer join网站遭受Hack, 有哪位知道如何处理?
SQL find distinct values in large tableSQL Server query 一问
MSSQL Power Function请求SQL语句
SQL question: update a field求助:如何ColumName 作为变量放入query
SQL combine two columns from two different tables no shared (转载)error of executing SQL query of string concatenation (转载
相关话题的讨论汇总
话题: like话题: rookie话题: b1话题: c1话题: question
进入Database版参与讨论
1 (共1页)
M***7
发帖数: 2420
1
I am new to SQL.
Q1:
Here I have a column. Some rows containing the name like "c1", some others
like "b1*" or "h10$".
I just want to select the rows like "c1" but not those "b1*".
Q2:
To create a scalar UDF, how to return more than one return value?
Thanks a lot.
n********6
发帖数: 1511
2
如果在sql server里面,可以用
SELECT * FROM Table1 WHERE Column1 like '[_]1'
[_]表示任意一个字符/数字。
不过你用“”表示字符串,可能你用oracle。我不知道oracle用什么表示。

【在 M***7 的大作中提到】
: I am new to SQL.
: Q1:
: Here I have a column. Some rows containing the name like "c1", some others
: like "b1*" or "h10$".
: I just want to select the rows like "c1" but not those "b1*".
: Q2:
: To create a scalar UDF, how to return more than one return value?
: Thanks a lot.

M***7
发帖数: 2420
3
could I use "where column1 not like" ?

【在 n********6 的大作中提到】
: 如果在sql server里面,可以用
: SELECT * FROM Table1 WHERE Column1 like '[_]1'
: [_]表示任意一个字符/数字。
: 不过你用“”表示字符串,可能你用oracle。我不知道oracle用什么表示。

n********6
发帖数: 1511
4
Yes.
Sorry I did not look at your question very carefully. In your case,
you want 'b1', not 'c1*'
You can use:
LIKE 'b1'
If you have other requirements, you can look at %, [], _, ...

【在 M***7 的大作中提到】
: could I use "where column1 not like" ?
M***7
发帖数: 2420
5
sth like "where column not like '%*'.
this works but I am not sure whether it is correct

【在 n********6 的大作中提到】
: Yes.
: Sorry I did not look at your question very carefully. In your case,
: you want 'b1', not 'c1*'
: You can use:
: LIKE 'b1'
: If you have other requirements, you can look at %, [], _, ...

n********6
发帖数: 1511
6
% represent unlimited characters for any values.

【在 M***7 的大作中提到】
: sth like "where column not like '%*'.
: this works but I am not sure whether it is correct

m**********2
发帖数: 2252
7
这个我会:
SELECT * FROM Table1
WHERE column like '%c1%'
and column not like '%b1%'

【在 M***7 的大作中提到】
: I am new to SQL.
: Q1:
: Here I have a column. Some rows containing the name like "c1", some others
: like "b1*" or "h10$".
: I just want to select the rows like "c1" but not those "b1*".
: Q2:
: To create a scalar UDF, how to return more than one return value?
: Thanks a lot.

B*****g
发帖数: 34098
8
看了我的link学得就是快

others

【在 m**********2 的大作中提到】
: 这个我会:
: SELECT * FROM Table1
: WHERE column like '%c1%'
: and column not like '%b1%'

n********6
发帖数: 1511
9
Good.

【在 m**********2 的大作中提到】
: 这个我会:
: SELECT * FROM Table1
: WHERE column like '%c1%'
: and column not like '%b1%'

1 (共1页)
进入Database版参与讨论
相关主题
error of executing SQL query of string concatenation (转载SQL find distinct values in large table
Help on Sql server huge table performanceMSSQL Power Function
Help! A cluster method in SQLSQL question: update a field
random error for CAST( MONEY AS VARCHAR)SQL combine two columns from two different tables no shared (转载)
SQL combine two tables into one table and add a new columnSQL add some columns into a table from another table (转载
SQL copy a table into a new table and add a new column[转载] 问个SQL问题
新手请教SQL 语法问题- alias 和 joinone question on SQL
问个SQL问题- partial outer join网站遭受Hack, 有哪位知道如何处理?
相关话题的讨论汇总
话题: like话题: rookie话题: b1话题: c1话题: question