sql query doesn't select the right value's I need
I'm trying to only select the data with numbers in them (the table looks like this):
eteee 231
wrgrr
test 1
bioo 21
wee
with the query: SELECT address1 FROM ps_address WHERE address1 not like '%[^0-9]%';
but i get all the values right back.
sql heidisql
|
show 6 more comments
I'm trying to only select the data with numbers in them (the table looks like this):
eteee 231
wrgrr
test 1
bioo 21
wee
with the query: SELECT address1 FROM ps_address WHERE address1 not like '%[^0-9]%';
but i get all the values right back.
sql heidisql
1
WHERE address1 like '%[0-9]%';
?
– jarlh
Nov 21 '18 at 9:49
Is "eteee 231" a single record or two separate records?
– iminiki
Nov 21 '18 at 9:54
eteee 231 is a single record
– user10384599
Nov 21 '18 at 9:56
@jarlh's comment does what you need I'm not sure why you had a 'not like' when you wanted a like with the numeric check.
– Rich Campbell
Nov 21 '18 at 10:02
when i try it with like and not with 'not like' I got no return at all
– user10384599
Nov 21 '18 at 10:14
|
show 6 more comments
I'm trying to only select the data with numbers in them (the table looks like this):
eteee 231
wrgrr
test 1
bioo 21
wee
with the query: SELECT address1 FROM ps_address WHERE address1 not like '%[^0-9]%';
but i get all the values right back.
sql heidisql
I'm trying to only select the data with numbers in them (the table looks like this):
eteee 231
wrgrr
test 1
bioo 21
wee
with the query: SELECT address1 FROM ps_address WHERE address1 not like '%[^0-9]%';
but i get all the values right back.
sql heidisql
sql heidisql
asked Nov 21 '18 at 9:48
user10384599
1
WHERE address1 like '%[0-9]%';
?
– jarlh
Nov 21 '18 at 9:49
Is "eteee 231" a single record or two separate records?
– iminiki
Nov 21 '18 at 9:54
eteee 231 is a single record
– user10384599
Nov 21 '18 at 9:56
@jarlh's comment does what you need I'm not sure why you had a 'not like' when you wanted a like with the numeric check.
– Rich Campbell
Nov 21 '18 at 10:02
when i try it with like and not with 'not like' I got no return at all
– user10384599
Nov 21 '18 at 10:14
|
show 6 more comments
1
WHERE address1 like '%[0-9]%';
?
– jarlh
Nov 21 '18 at 9:49
Is "eteee 231" a single record or two separate records?
– iminiki
Nov 21 '18 at 9:54
eteee 231 is a single record
– user10384599
Nov 21 '18 at 9:56
@jarlh's comment does what you need I'm not sure why you had a 'not like' when you wanted a like with the numeric check.
– Rich Campbell
Nov 21 '18 at 10:02
when i try it with like and not with 'not like' I got no return at all
– user10384599
Nov 21 '18 at 10:14
1
1
WHERE address1 like '%[0-9]%';
?– jarlh
Nov 21 '18 at 9:49
WHERE address1 like '%[0-9]%';
?– jarlh
Nov 21 '18 at 9:49
Is "eteee 231" a single record or two separate records?
– iminiki
Nov 21 '18 at 9:54
Is "eteee 231" a single record or two separate records?
– iminiki
Nov 21 '18 at 9:54
eteee 231 is a single record
– user10384599
Nov 21 '18 at 9:56
eteee 231 is a single record
– user10384599
Nov 21 '18 at 9:56
@jarlh's comment does what you need I'm not sure why you had a 'not like' when you wanted a like with the numeric check.
– Rich Campbell
Nov 21 '18 at 10:02
@jarlh's comment does what you need I'm not sure why you had a 'not like' when you wanted a like with the numeric check.
– Rich Campbell
Nov 21 '18 at 10:02
when i try it with like and not with 'not like' I got no return at all
– user10384599
Nov 21 '18 at 10:14
when i try it with like and not with 'not like' I got no return at all
– user10384599
Nov 21 '18 at 10:14
|
show 6 more comments
3 Answers
3
active
oldest
votes
Try this REGEXP
:
SELECT address1 FROM ps_address WHERE address1 REGEXP '[[:digit:]]';
This returns the rows containing digits anywhere inside address1
.
thx that works for me !
– user10384599
Nov 21 '18 at 10:29
add a comment |
You can simply write:
SELECT address1 FROM ps_address WHERE address1 like '%[0-9]%';
when i try that query I get no return what so ever
– user10384599
Nov 21 '18 at 10:11
Are you sure the column's name is address1?
– iminiki
Nov 21 '18 at 10:14
yes i am sure of that
– user10384599
Nov 21 '18 at 10:15
Remember, my query does not include " ^ " as your original one.
– iminiki
Nov 21 '18 at 10:20
yes i know, and there is no return at all
– user10384599
Nov 21 '18 at 10:23
add a comment |
this will work :
SELECT address1 FROM ps_address WHERE regexp_like(address1,'.*[0-9]+.*');
When i try that query I get the error that the regexp_like function doesn't exicst
– user10384599
Nov 21 '18 at 10:13
its all working in my db i dont know what is heideisql but for orcale i ts working
– nikhil sugandh
Nov 21 '18 at 10:32
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53409254%2fsql-query-doesnt-select-the-right-values-i-need%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try this REGEXP
:
SELECT address1 FROM ps_address WHERE address1 REGEXP '[[:digit:]]';
This returns the rows containing digits anywhere inside address1
.
thx that works for me !
– user10384599
Nov 21 '18 at 10:29
add a comment |
Try this REGEXP
:
SELECT address1 FROM ps_address WHERE address1 REGEXP '[[:digit:]]';
This returns the rows containing digits anywhere inside address1
.
thx that works for me !
– user10384599
Nov 21 '18 at 10:29
add a comment |
Try this REGEXP
:
SELECT address1 FROM ps_address WHERE address1 REGEXP '[[:digit:]]';
This returns the rows containing digits anywhere inside address1
.
Try this REGEXP
:
SELECT address1 FROM ps_address WHERE address1 REGEXP '[[:digit:]]';
This returns the rows containing digits anywhere inside address1
.
answered Nov 21 '18 at 10:26
forpasforpas
12.5k3424
12.5k3424
thx that works for me !
– user10384599
Nov 21 '18 at 10:29
add a comment |
thx that works for me !
– user10384599
Nov 21 '18 at 10:29
thx that works for me !
– user10384599
Nov 21 '18 at 10:29
thx that works for me !
– user10384599
Nov 21 '18 at 10:29
add a comment |
You can simply write:
SELECT address1 FROM ps_address WHERE address1 like '%[0-9]%';
when i try that query I get no return what so ever
– user10384599
Nov 21 '18 at 10:11
Are you sure the column's name is address1?
– iminiki
Nov 21 '18 at 10:14
yes i am sure of that
– user10384599
Nov 21 '18 at 10:15
Remember, my query does not include " ^ " as your original one.
– iminiki
Nov 21 '18 at 10:20
yes i know, and there is no return at all
– user10384599
Nov 21 '18 at 10:23
add a comment |
You can simply write:
SELECT address1 FROM ps_address WHERE address1 like '%[0-9]%';
when i try that query I get no return what so ever
– user10384599
Nov 21 '18 at 10:11
Are you sure the column's name is address1?
– iminiki
Nov 21 '18 at 10:14
yes i am sure of that
– user10384599
Nov 21 '18 at 10:15
Remember, my query does not include " ^ " as your original one.
– iminiki
Nov 21 '18 at 10:20
yes i know, and there is no return at all
– user10384599
Nov 21 '18 at 10:23
add a comment |
You can simply write:
SELECT address1 FROM ps_address WHERE address1 like '%[0-9]%';
You can simply write:
SELECT address1 FROM ps_address WHERE address1 like '%[0-9]%';
answered Nov 21 '18 at 10:03
iminikiiminiki
751620
751620
when i try that query I get no return what so ever
– user10384599
Nov 21 '18 at 10:11
Are you sure the column's name is address1?
– iminiki
Nov 21 '18 at 10:14
yes i am sure of that
– user10384599
Nov 21 '18 at 10:15
Remember, my query does not include " ^ " as your original one.
– iminiki
Nov 21 '18 at 10:20
yes i know, and there is no return at all
– user10384599
Nov 21 '18 at 10:23
add a comment |
when i try that query I get no return what so ever
– user10384599
Nov 21 '18 at 10:11
Are you sure the column's name is address1?
– iminiki
Nov 21 '18 at 10:14
yes i am sure of that
– user10384599
Nov 21 '18 at 10:15
Remember, my query does not include " ^ " as your original one.
– iminiki
Nov 21 '18 at 10:20
yes i know, and there is no return at all
– user10384599
Nov 21 '18 at 10:23
when i try that query I get no return what so ever
– user10384599
Nov 21 '18 at 10:11
when i try that query I get no return what so ever
– user10384599
Nov 21 '18 at 10:11
Are you sure the column's name is address1?
– iminiki
Nov 21 '18 at 10:14
Are you sure the column's name is address1?
– iminiki
Nov 21 '18 at 10:14
yes i am sure of that
– user10384599
Nov 21 '18 at 10:15
yes i am sure of that
– user10384599
Nov 21 '18 at 10:15
Remember, my query does not include " ^ " as your original one.
– iminiki
Nov 21 '18 at 10:20
Remember, my query does not include " ^ " as your original one.
– iminiki
Nov 21 '18 at 10:20
yes i know, and there is no return at all
– user10384599
Nov 21 '18 at 10:23
yes i know, and there is no return at all
– user10384599
Nov 21 '18 at 10:23
add a comment |
this will work :
SELECT address1 FROM ps_address WHERE regexp_like(address1,'.*[0-9]+.*');
When i try that query I get the error that the regexp_like function doesn't exicst
– user10384599
Nov 21 '18 at 10:13
its all working in my db i dont know what is heideisql but for orcale i ts working
– nikhil sugandh
Nov 21 '18 at 10:32
add a comment |
this will work :
SELECT address1 FROM ps_address WHERE regexp_like(address1,'.*[0-9]+.*');
When i try that query I get the error that the regexp_like function doesn't exicst
– user10384599
Nov 21 '18 at 10:13
its all working in my db i dont know what is heideisql but for orcale i ts working
– nikhil sugandh
Nov 21 '18 at 10:32
add a comment |
this will work :
SELECT address1 FROM ps_address WHERE regexp_like(address1,'.*[0-9]+.*');
this will work :
SELECT address1 FROM ps_address WHERE regexp_like(address1,'.*[0-9]+.*');
edited Nov 21 '18 at 10:04
answered Nov 21 '18 at 9:55
nikhil sugandhnikhil sugandh
1,2762719
1,2762719
When i try that query I get the error that the regexp_like function doesn't exicst
– user10384599
Nov 21 '18 at 10:13
its all working in my db i dont know what is heideisql but for orcale i ts working
– nikhil sugandh
Nov 21 '18 at 10:32
add a comment |
When i try that query I get the error that the regexp_like function doesn't exicst
– user10384599
Nov 21 '18 at 10:13
its all working in my db i dont know what is heideisql but for orcale i ts working
– nikhil sugandh
Nov 21 '18 at 10:32
When i try that query I get the error that the regexp_like function doesn't exicst
– user10384599
Nov 21 '18 at 10:13
When i try that query I get the error that the regexp_like function doesn't exicst
– user10384599
Nov 21 '18 at 10:13
its all working in my db i dont know what is heideisql but for orcale i ts working
– nikhil sugandh
Nov 21 '18 at 10:32
its all working in my db i dont know what is heideisql but for orcale i ts working
– nikhil sugandh
Nov 21 '18 at 10:32
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53409254%2fsql-query-doesnt-select-the-right-values-i-need%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
WHERE address1 like '%[0-9]%';
?– jarlh
Nov 21 '18 at 9:49
Is "eteee 231" a single record or two separate records?
– iminiki
Nov 21 '18 at 9:54
eteee 231 is a single record
– user10384599
Nov 21 '18 at 9:56
@jarlh's comment does what you need I'm not sure why you had a 'not like' when you wanted a like with the numeric check.
– Rich Campbell
Nov 21 '18 at 10:02
when i try it with like and not with 'not like' I got no return at all
– user10384599
Nov 21 '18 at 10:14