Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[sql-general] Re: SQL Query Help Needed

13 views
Skip to first unread message

mllam_98

unread,
Jul 23, 2004, 4:47:39 PM7/23/04
to
Get all of your lanesid's into a coldfusion list. I am assuming the
lanesid are numbers. Order the list the same way you order the query

Then try this
<cfquery name="getall">
select lanesid from dolls, products
</cfquery>


<cfoutput query=getall>

<cfif Listcontains(listname, #getall.lanesid#>

<cfelse>
<cfset deletelist=Listappend(deletelist,#getallLanesid#)>
</cfoutput>

Then you can write a query to delete everything in the delete list

<cfquery>
delete from products where laneid in(#deletelist#)
</cfquery>

This is completely untested. I just think this would work.

Maria Lambert


--- In sql-g...@yahoogroups.com, "Donna" <mail@d...> wrote:
> I need help writing a query and I'll go ahead and warn you that
when
> I built this database I had no idea what I was doing and have
> more/less patched it together as I've learned more over the past
few
> years. I'm currently designing a new database and rewriting the
> application in CFMX - but for now I need help writing a query to
> clean up files on the server that are no longer needed.
>
> There are 2 tables I need to look at:
>
> DOLLS
> lanesID(text)
> dollID(auto#)
> other fields n/a to my question...
>
> PRODUCTS
> lanesID(text)
> productID(auto#)
> other fields n/a to my question...
>
> And there are 3 folders I need to work with:
>
> /images/400
> /images/200
> /images/85
>
> What I need to accomplish is to look at the images and if the image
> (lanesID.jpg) is NOT in either table (dolls or products) I must
> delete the file.
>
> I realize I must build a list of lanesID from both tables then loop
> thru each image and see if it's listed but the actual SQL I'm not
> sure how to write.
>
> Any help would be greatly appreciated.
>
>
> TIA,
> Donna

------------------------ Yahoo! Groups Sponsor --------------------~-->
Yahoo! Domains - Claim yours for only $14.70
http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/PhFolB/TM
--------------------------------------------------------------------~->

Subscribe: sql-genera...@yahoogroups.com
Unsubscribe: sql-general...@yahoogroups.com
List owner: sql-gene...@yahoogroups.com
URL: http://groups.yahoo.com/group/sql-general
Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/sql-general/

<*> To unsubscribe from this group, send an email to:
sql-general...@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/

Donna

unread,
Jul 29, 2004, 3:55:47 PM7/29/04
to
I have built a list of the lanesID's but I need to delete the files
off the server (JPG files) - not the records from a DB.

Any suggestions?

TIA,
DOnna

Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/PhFolB/TM

mllam_98

unread,
Jul 29, 2004, 5:15:28 PM7/29/04
to
This might work

<cfloop list=#deletelist# index=i>
<cffile action="DELETE" file="#i#.jpg">
</cfloop>

Yahoo! Domains - Claim yours for only $14.70
http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/PhFolB/TM

jho...@gmail.com

unread,
Feb 20, 2013, 4:38:20 AM2/20/13
to
I don't have any experience about SQL but i can recommend websites which will surely help you there is lot of materials & tutorials about SQL visit lynda.com

jho...@gmail.com

unread,
Feb 20, 2013, 4:39:51 AM2/20/13
to
0 new messages