|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
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 |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > Two at once |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|