group by like stringHow to create an Sql table from SELECT with a multiple row DISTINCT constraint?UPDATE...

A dragon's soul trapped in a ring of mind shielding wants a new body; what magic could enable her to do so?

Why does Python copy numpy arrays where the length of the dimensions are the same?

What is the small cylinder on the firewall to the left of the battery?

Why are energy weapons seen as more acceptable in children's shows than guns that fire bullets?

Bacterial growth inhibitors used in Deodorants

Should corporate security training be tailored based on a users' job role?

Does limiting the number of sources help simplify the game for a new DM with new and experienced players?

Is it possible to make a dynamically risizing filesystem-as-file?

Is it appropriate to give a culturally-traditional gift to a female coworker?

Is candidate anonymity at all practical?

Border strip tableau

Why is the movie titled Gothika?

Can neural cryptanalysis be applied to AES?

How does a single engine tail wheel landing gear airplane turn when it is on the ground?

How to run a binary file from crontab?

Why did Tywin never remarry?

Does anyone recognize this inequality?

How can I learn to care less because it makes me sick?

How to not forget my phone in bathroom?

I have a single ethernet switch. Should I use spanning tree?

Did President Obama tell President Trump he was close to starting a war with North Korea?

How do I add numbers from two txt files with Bash?

This Website Needs More Cat Pictures?

How to tell readers your story is a re-imagination of a popular story?



group by like string


How to create an Sql table from SELECT with a multiple row DISTINCT constraint?UPDATE Query replacing string primary key taking days to resolveSelecting aggregated string from databaseHow to calculate shift hours in postgres?DB design for employee working hours constraintsSQL - find records that are prefixes of my stringCan't we make a non-primary key or non-unique key in a table as a foreign key in another table?Postgres Join multiple table to replace id of parent table with valueIs there any string compaction option for PostgreSQL?PostgreSQL results of conditional insert













0















I have a table employee in this table i have id company_name employee_id



1 abc  2015_acb_1 
2 abc 2015_acb_2
3 abc 2015_acb_3
4 abc 2015_acb_4
5 xyz 2016_xyz_9
5 xyz 2017_xyz_2
5 xyz 2016_xyz_3
5 xyz 2019_xyz_5


I want to select unique string such as from employee table



_abc_
_xyz_


i have try select employee_id where employee_id like %_%; its not giving as i expected










share|improve this question







New contributor




deviya is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • Are you always looking for the characters between the two _ characters? Or always for three characters starting at the sixth?

    – a_horse_with_no_name
    5 hours ago
















0















I have a table employee in this table i have id company_name employee_id



1 abc  2015_acb_1 
2 abc 2015_acb_2
3 abc 2015_acb_3
4 abc 2015_acb_4
5 xyz 2016_xyz_9
5 xyz 2017_xyz_2
5 xyz 2016_xyz_3
5 xyz 2019_xyz_5


I want to select unique string such as from employee table



_abc_
_xyz_


i have try select employee_id where employee_id like %_%; its not giving as i expected










share|improve this question







New contributor




deviya is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • Are you always looking for the characters between the two _ characters? Or always for three characters starting at the sixth?

    – a_horse_with_no_name
    5 hours ago














0












0








0








I have a table employee in this table i have id company_name employee_id



1 abc  2015_acb_1 
2 abc 2015_acb_2
3 abc 2015_acb_3
4 abc 2015_acb_4
5 xyz 2016_xyz_9
5 xyz 2017_xyz_2
5 xyz 2016_xyz_3
5 xyz 2019_xyz_5


I want to select unique string such as from employee table



_abc_
_xyz_


i have try select employee_id where employee_id like %_%; its not giving as i expected










share|improve this question







New contributor




deviya is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












I have a table employee in this table i have id company_name employee_id



1 abc  2015_acb_1 
2 abc 2015_acb_2
3 abc 2015_acb_3
4 abc 2015_acb_4
5 xyz 2016_xyz_9
5 xyz 2017_xyz_2
5 xyz 2016_xyz_3
5 xyz 2019_xyz_5


I want to select unique string such as from employee table



_abc_
_xyz_


i have try select employee_id where employee_id like %_%; its not giving as i expected







postgresql postgresql-performance






share|improve this question







New contributor




deviya is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




deviya is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




deviya is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 6 hours ago









deviyadeviya

1




1




New contributor




deviya is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





deviya is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






deviya is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.













  • Are you always looking for the characters between the two _ characters? Or always for three characters starting at the sixth?

    – a_horse_with_no_name
    5 hours ago



















  • Are you always looking for the characters between the two _ characters? Or always for three characters starting at the sixth?

    – a_horse_with_no_name
    5 hours ago

















Are you always looking for the characters between the two _ characters? Or always for three characters starting at the sixth?

– a_horse_with_no_name
5 hours ago





Are you always looking for the characters between the two _ characters? Or always for three characters starting at the sixth?

– a_horse_with_no_name
5 hours ago










1 Answer
1






active

oldest

votes


















1














SELECT DISTINCT SUBSTRING(employee_id FROM 5 FOR 5)
FROM employee;





share|improve this answer
























  • what is 5 FOR 5 ?

    – deviya
    6 hours ago











  • SELECT DISTINCT SUBSTRING( of employee_id field starting FROM 5th symbol FOR 5 chars length ).

    – Akina
    6 hours ago











  • sir some of record contains 3 to 4 _ symbol and position is different

    – deviya
    6 hours ago











  • like 2017_HCL_012346_3_4 and 2016_TCS_375_875_2

    – deviya
    6 hours ago











  • What do you want from these strings then?

    – Lennart
    6 hours ago











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "182"
};
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: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
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
});


}
});






deviya is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f230097%2fgroup-by-like-string%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














SELECT DISTINCT SUBSTRING(employee_id FROM 5 FOR 5)
FROM employee;





share|improve this answer
























  • what is 5 FOR 5 ?

    – deviya
    6 hours ago











  • SELECT DISTINCT SUBSTRING( of employee_id field starting FROM 5th symbol FOR 5 chars length ).

    – Akina
    6 hours ago











  • sir some of record contains 3 to 4 _ symbol and position is different

    – deviya
    6 hours ago











  • like 2017_HCL_012346_3_4 and 2016_TCS_375_875_2

    – deviya
    6 hours ago











  • What do you want from these strings then?

    – Lennart
    6 hours ago
















1














SELECT DISTINCT SUBSTRING(employee_id FROM 5 FOR 5)
FROM employee;





share|improve this answer
























  • what is 5 FOR 5 ?

    – deviya
    6 hours ago











  • SELECT DISTINCT SUBSTRING( of employee_id field starting FROM 5th symbol FOR 5 chars length ).

    – Akina
    6 hours ago











  • sir some of record contains 3 to 4 _ symbol and position is different

    – deviya
    6 hours ago











  • like 2017_HCL_012346_3_4 and 2016_TCS_375_875_2

    – deviya
    6 hours ago











  • What do you want from these strings then?

    – Lennart
    6 hours ago














1












1








1







SELECT DISTINCT SUBSTRING(employee_id FROM 5 FOR 5)
FROM employee;





share|improve this answer













SELECT DISTINCT SUBSTRING(employee_id FROM 5 FOR 5)
FROM employee;






share|improve this answer












share|improve this answer



share|improve this answer










answered 6 hours ago









AkinaAkina

4,0361311




4,0361311













  • what is 5 FOR 5 ?

    – deviya
    6 hours ago











  • SELECT DISTINCT SUBSTRING( of employee_id field starting FROM 5th symbol FOR 5 chars length ).

    – Akina
    6 hours ago











  • sir some of record contains 3 to 4 _ symbol and position is different

    – deviya
    6 hours ago











  • like 2017_HCL_012346_3_4 and 2016_TCS_375_875_2

    – deviya
    6 hours ago











  • What do you want from these strings then?

    – Lennart
    6 hours ago



















  • what is 5 FOR 5 ?

    – deviya
    6 hours ago











  • SELECT DISTINCT SUBSTRING( of employee_id field starting FROM 5th symbol FOR 5 chars length ).

    – Akina
    6 hours ago











  • sir some of record contains 3 to 4 _ symbol and position is different

    – deviya
    6 hours ago











  • like 2017_HCL_012346_3_4 and 2016_TCS_375_875_2

    – deviya
    6 hours ago











  • What do you want from these strings then?

    – Lennart
    6 hours ago

















what is 5 FOR 5 ?

– deviya
6 hours ago





what is 5 FOR 5 ?

– deviya
6 hours ago













SELECT DISTINCT SUBSTRING( of employee_id field starting FROM 5th symbol FOR 5 chars length ).

– Akina
6 hours ago





SELECT DISTINCT SUBSTRING( of employee_id field starting FROM 5th symbol FOR 5 chars length ).

– Akina
6 hours ago













sir some of record contains 3 to 4 _ symbol and position is different

– deviya
6 hours ago





sir some of record contains 3 to 4 _ symbol and position is different

– deviya
6 hours ago













like 2017_HCL_012346_3_4 and 2016_TCS_375_875_2

– deviya
6 hours ago





like 2017_HCL_012346_3_4 and 2016_TCS_375_875_2

– deviya
6 hours ago













What do you want from these strings then?

– Lennart
6 hours ago





What do you want from these strings then?

– Lennart
6 hours ago










deviya is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















deviya is a new contributor. Be nice, and check out our Code of Conduct.













deviya is a new contributor. Be nice, and check out our Code of Conduct.












deviya is a new contributor. Be nice, and check out our Code of Conduct.
















Thanks for contributing an answer to Database Administrators Stack Exchange!


  • 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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f230097%2fgroup-by-like-string%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

Anexo:Material bélico de la Fuerza Aérea de Chile Índice Aeronaves Defensa...

Always On Availability groups resolving state after failover - Remote harden of transaction...

update json value to null Announcing the arrival of Valued Associate #679: Cesar Manara ...