Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft SQL Server

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 ASP Free Forums Sponsor:
  #1  
Old December 6th, 2004, 01:31 AM
cvanoosbree cvanoosbree is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 3 cvanoosbree User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 52 m 39 sec
Reputation Power: 0
Question cross referencing tables

hi all,

i am wondering if someone can help me with a sql script that would help me cross reference data from one table vs another.

what i need to show is .. which qty's from one table matches the other qty field in the other table that has a similar .. either description and or +1 to -1 months on the date range

this is from my table called "physical"
product_idqtypo_numberdate_purchased332ERP0005530/01/2004611ERP0005530/01/2004685ERP0005530/01/2004625ERP0005530/01/200470530/01/20046631/07/2002816NS45028/09/20013910NS45028/09/2001425INV I448442 (Fujitsu)31/05/2001


this is from my table called "bart"
po_numberdate_purchasedLocationQtyNS57926/06/200226RO-62526/06/200225JO-38826/06/200241ME58226/06/200216210WO26/06/2002WO26BH-016 ERP0009918/05/2004BH38BH-016 ERP0009918/05/2004BH13814/05/20031512/06/2003213/02/20043ERP0007830/03/20042

and this is from my other table called "invoices"
product_idqtypo_numberdate_purchased816NS45028/09/20013910NS45028/09/2001425INV I448442 (Fujitsu)31/05/2001103019/11/200113319/11/2001293019/11/20016426NS57926/06/2002

and hopefully do another query where my "invoices" table can be verified against both.

did this make any sense?

in the end, i looked for invoices and put them into the db, i also got data from our vendor (hense the name bart) and then looked at the physical licenses. i put all this data into the db and just need to cross reference all of them

thanks
Chuck

Reply With Quote
  #2  
Old December 7th, 2004, 01:36 AM
cvanoosbree cvanoosbree is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 3 cvanoosbree User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 52 m 39 sec
Reputation Power: 0
hi all,

just noticed how badly my first post was. didnt think the data would come out that way. sorry about that.

well, moving forward i have started messing with what i am trying to do. however, something is not correct

this is my sql statement

SELECT A.po_number AS APO, A.Location AS ALOC, A.date_purchased AS APURCHASED, A.Qty AS AQTY, B.qty AS BQTY, B.locale_id AS BLOC,
B.po_number AS BPO, B.date_purchased AS BPURCHASED, B.note AS BNOTE
FROM sw_bart A LEFT OUTER JOIN
sw_purchase B ON A.Qty = B.qty
WHERE (A.date_purchased BETWEEN A.date_purchased AND B.date_purchased)

and this is the data that comes out of it
JO-388 26/06/2002 41 41 JP JO388 26/06/2002
ME582 26/06/2002 16 16 ME ME582 26/06/2002
RO-625 26/06/2002 25 25 RO RO-625 26/06/2002
14/06/2002 51 51 BH 3417 8/09/2004 issue:MS47306
ERP00026 31/03/2003 1 1 NS 15/11/2004 cert:10885153-2592621

as you can tell, its the date field from both tables. however, the dates are not even closely related. i was wanting to do a datediff function where the month can be <>1 month but i dont know the sql query to pull it off

can anyone assist please?
thanks
Chuck

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft SQL Server > cross referencing tables


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 2 hosted by Hostway
Stay green...Green IT