473,748 Members | 2,221 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 1734
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
1553
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
2974
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
12837
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
4298
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
7857
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
4410
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
1664
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
1073
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
1652
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
8982
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
9528
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
9357
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...
0
9234
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...
0
8235
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6792
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4591
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3298
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
3
2205
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.