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%'
|