Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can this be done in SQL?
Message
 
 
À
11/08/2008 09:31:41
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01338010
Message ID:
01338026
Vues:
16
This message has been marked as the solution to the initial question of the thread.
>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 )

Tom,

I think you can JOIN two tables based on LIKE condition, e.g.

select * from OneTable T1 INNER JOIN OtherTable T2 on T1.Field LIKE T2.Field+"%"

Not sure about the performance, though.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform