MS SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMS SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old June 24th, 2004, 01:25 PM
cessua cessua is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: USA (Boston area)
Posts: 81 cessua User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 h 42 m 44 sec
Reputation Power: 5
Two at once

Hi, i am new to SQL, i am writting a two queries in one in a VBScript and each query independently work fine, but i don't know how to put them together.

The first one is:
Code:
DELETE FROM [test_item] WHERE fngp_item BETWEEN '0' AND '9'

And the second one is:
Code:
SELECT p.fngp_item,p.project_leader,p.project_lead_center,p.project_location,m.milestone_name,i.keyed_name,   m.milestone_leader, m.mgr_opinion FROM PROJECT p INNER JOIN PROJECT_MILESTONE pm ON p.id = pm.source_id INNER JOIN MILESTONE m ON pm.related_id = m.id INNER JOIN [IDENTITY] i ON m.milestone_leader = i.id WHERE m.mgr_opinion='#ff0000'


The database 'test_item is different than the database 'PROJECT'.

I basically want to delete everything in 'test_item' and get the data i want from the second query at same time.

I have tried to use: JOIN, UNION, AND, but none of them seem to work.

Is there a way i can run those two queries at same time?

Thanks

Reply With Quote
  #2  
Old June 24th, 2004, 02:55 PM
cessua cessua is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: USA (Boston area)
Posts: 81 cessua User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 h 42 m 44 sec
Reputation Power: 5
reply

I got it working...

This is what i am doing,

Code:
sqll="DELETE FROM [test_item] WHERE fngp_item BETWEEN '000000' AND '9999999' OR fngp_item BETWEEN 'a' AND 'z'" 
ExecuteSQL conn, sqll

sql="SELECT p.fngp_item,p.project_leader,p.project_lead_center,p.project_location,m.milestone_name,i.keyed_name,   m.milestone_leader, m.mgr_opinion FROM PROJECT p INNER JOIN PROJECT_MILESTONE pm ON p.id = pm.source_id INNER JOIN MILESTONE m ON pm.related_id = m.id INNER JOIN [IDENTITY] i ON m.milestone_leader = i.id WHERE m.mgr_opinion='#ff0000'" 
set rs = conn.execute(sql)


Thanks anyway.

Me

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMS SQL Development > Two at once


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway