473,856 Members | 1,708 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Find Partial Text From Return Of Subquery

76 New Member
I don't even know if this is even possible but I figured it'd make my life a lot easier if it was. I have an organizational table with departments and subdepartments that has a chain of command listing in it. (I didn't design it, don't shoot me, I'm just having to fix it). What I need to do is find a department and all departments beneath it based on the passed in value of the department's ID. I'm right now keying off the chain of command since the chain of command is from the top down.

SELECT *
FROM Department
WHERE (COC LIKE
(SELECT COC
FROM Department
WHERE DeptID = '12345'))

Though of course this doesn't work. It will only return those identical to the returned value. If I were to just "do it" without a subquery it'd be
SELECT * FROM Department WHERE COC LIKE '1;14;16;232;12 345;' and it would return everything from this department downward.

Is there a way to do a partial like on a subquery results?
Jan 25 '07 #1
1 1739
iburyak
1,017 Recognized Expert Top Contributor
Not sure if I understood you correctly but try this:

Select *
from Department a
join Department b on a.COC = b.DeptID
where a.DeptID = '12345'
Jan 25 '07 #2

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

Similar topics

1
1557
by: Al | last post by:
Hi, I am currently using IndexOf to see if a string contains another string but it only works if there is exact match. In case of misspelling etc it wont work. I was wondering if anyone aware of partial text matching algorithm or routine for VB.net. Furthermore, since I need to apply this to many records in database I need the routine be very fast. Many thanks in advance Al
3
2979
by: Lucky | last post by:
Hi guys! it's me againe! this time i'm facing some problem with the .NET 2005 IDE. i've created one "website" and i've added one webform. now i can see 2 files default.aspx and default.aspx.cs but i can see the "Windows Generated Code" in CS file. i searched for it and found that that code is written in the default.Designer.aspx.cs but what surprised me is THAT FILE DOESNT EXISTS in my project neigther in the web folder.
2
12844
by: Bryan_Cockrell | last post by:
Hi World, I am extracting text from an ebcdic header using dd in the cygwin environment (bash/ksh) as below in order to rename the file to something intelligent. I'm using a specific string position here ($10) but the text I extract is sometimes in a different position in the header so I need to search for preceding text "LINE:" and then extract the next string, which is the info I'm interested in. So - using awk or sed (or perl if need...
1
4302
by: amber.inc | last post by:
HI, I would like to know how can i find a text of a PDF file and change the forecolor of the text to blue with the help of JAVASCRIPT or any other language so that it can work on Acrobat 5.0. Presently i m doing it by manually selcting the text and changing the color attribute. Kindly help me to automate this process. The PDF contains 300 to 400 pages. Regards,
8
7860
by: kingskippus | last post by:
I don't know if this is possible, but I haven't been able to find any information. I have two tables, for example: Table 1 (two columns, id and foo) id foo --- ----- 1 foo_a 2 foo_b
1
4420
by: rmr | last post by:
Hi, I would like to restrict the text that appears in a cell to the first few letters or a fixed width in pixel. And for other processing reasons I wish the full text to be available in the cell for access via Javascript. For example, I may have the following text in a cell IT/Developer Network HTML/CSS Forum And I may wish that only the first 20 characters be displayed even though the cell contains the full text; or it shows say the...
3
1668
by: Lauren Quantrell | last post by:
I have an HTML file named myHTML.htm It looks like this: <great HTML code> <more great HTML code> <even more great HTML code> <insert HTML here>
1
1077
by: gravikrishna | last post by:
hello sir pls tell me the code of my question how do u find total text of a html page in .net
1
1657
by: Malvika Shrivastava | last post by:
Hi everyone, I want to find the text which is highlighted with a particular colour in a word document. Thanks, Malvika.
0
9903
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
9755
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11048
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10692
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10770
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10376
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
4567
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4168
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3194
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.