General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Can this be done in SQL?
Environment versions
Network:
Windows 2003 Server
CREATE CURSOR emptydir (dir v(20))
INSERT INTO emptydir VALUES ( '/a/b/c/' )
INSERT INTO emptydir VALUES ( '/d/e/' )
INSERT INTO emptydir VALUES ( '/x/y/z/' )
CREATE CURSOR fulldir (dir v(20))
INSERT INTO fulldir VALUES ( '/a/b/c/d/' )
INSERT INTO fulldir VALUES ( '/d/e/f/' )
The emptydir cursor represents empty directories. However, the fulldir cursor has an entry one level deeper than the emptydir entry. What I want is a way in SQL to show that entries /a/b/c/ and /d/e/ in emptydir are ones with similar constructs (but one level deeper) in fulldir. The exception is /x/y/z/ which is in emptydir but not in fulldir.
Can I use something like LIKE or CONTAINS or ??? such that in the end I return only the /x/y/z/ entry in emtpydir? I am only interested in how this can be done using SQL.
SELECT * FROM emptydir WHERE dir LIKE (SELECT dir FROM fulldir )
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only