473,396 Members | 1,789 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

sql find exact string, NOT LIKE

2
i have table with two column

ID and groups.


ID: (1) (2) (3)
Groups: (2,12,21) (11,1,31) (43,44,144)


i want to find id with group 1, if i use "Like" , i am receiving every ID with number 1 in groups: 12,21,11,1,31,144.
answer will be (1) (2) (3)


i want just second ID with group number 1

ID (2)

maybe there is some Substring function, and i'm able to separate this values by ","

sorry for bad English
Oct 23 '13 #1
5 1854
Rabbit
12,516 Expert Mod 8TB
You are having so much trouble because your data is not normalized. It's poorly structured. Please read our article on normalization and then restructure your data.
http://bytes.com/topic/access/insigh...ble-structures
Oct 23 '13 #2
lukaxa
2
this is not an option. this data is fixed and given from other person.

how can i normalize data?

there can be 2 group per user or 1000 group per user. i can't create columns for each one.
Oct 23 '13 #3
Rabbit
12,516 Expert Mod 8TB
You don't create a column for each one. That's against normalization. You create a row for each id/group member. Given the data above, a normalized structure would have 2 columns and 9 rows. But you can't normalize your data so that's a moot point.

Your only option then is to build a custom parser using VBA code. You won't be able to do it using just SQL alone.
Oct 23 '13 #4
Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM table WHERE GROUPS LIKE '%,1,%'
I think will do the trick...
Oct 31 '13 #5
Rabbit
12,516 Expert Mod 8TB
@Basanth, that won't work because it doesn't separate the groups within the the field.
Oct 31 '13 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

19
by: linzhenhua1205 | last post by:
I want to parse a string like C program parse the command line into argc & argv. I hope don't use the array the allocate a fix memory first, and don't use the memory allocate function like malloc....
6
by: Jozef Jarosciak | last post by:
Quickest way to find the string in 1 dimensional string array! I have a queue 1 dimensional array of strings called 'queue' and I need a fast way to search it. Once there is match, I don't need...
2
by: Robin Tucker | last post by:
Hiya, Regular expressions always do my gnads in - can anyone cook up a reg expression to find all string literals in my code? I would like to put them into a resource file for future...
4
by: Akihiro KAYAMA | last post by:
Hi all. I would like to ask how I can implement string-like class using tuple or list. Does anyone know about some example codes of pure python implementation of string-like class? Because I...
2
by: Ross Ylitalo | last post by:
I have been trying to put together a regular expression that will trap any string with the exact string "&#" (without the quotes) and have been having no luck. Can anyone tell me if this is...
2
by: Gaijinco | last post by:
I was trying a function that read an string (which previously had attached two special characters & for the beginning of the word and # for the end of the word) and if it was "<word>ize" it changed...
1
by: sai14 | last post by:
Hi all, i would like to know if it is possible find particular string in a text file using vc++? please do let me know how to write the syntax Thanks
5
by: somanathan | last post by:
I have string like this jr:name=AdamAdamParoreAdamGilChrist I want to find the exact string here.Say for e.g If I want Adam it should give me only that string. If I use contains(jr:name,'Adam')...
2
by: powerfulperl | last post by:
I want to locate a string 'Local=IN' from a file and I am sure that this string is located within 100 lines(assumption) from the beginning of the file out of 5000 lines. The 100th line start with the...
5
by: andy1989 | last post by:
I am trying to find a string in excel sheet and store the string cell address in an array. This string appears several times. By storing every cell address where the string is located, im checking if...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.