Welcome to dbForumz.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Join Tables that don't have exact matches

 
   Database Forums (Home) -> MSEQ RSS
Next:  partial search performance  
Author Message
Queryless in SLC

External


Since: Dec 19, 2007
Posts: 1



(Msg. 1) Posted: Wed Dec 19, 2007 1:01 pm
Post subject: Join Tables that don't have exact matches
Archived from groups: microsoft>public>sqlserver>mseq (more info?)

I have a table that has a Sales Tax Code and an Invoice Date (ex. 7/04/07)
and another table that has the Sales Tax Code, Tax Rate, and Effective Date.
The second table can have the same Sales Tax Code with a different Tax Rate
and Effective Date. I want to select only one Tax Rate record from the
second table and that is the one that has the greatest effective date that is
also less than the invoice date.

I have tried the Top 1 method in a join and where statement, but it is not
actually limiting the records from the second table.

 >> Stay informed about: Join Tables that don't have exact matches 
Back to top
Login to vote
Vishal Parkar

External


Since: Jan 09, 2008
Posts: 1



(Msg. 2) Posted: Wed Jan 09, 2008 12:48 pm
Post subject: RE: Join Tables that don't have exact matches [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

can you post some sample records and expected result set out of it.

--
Vishal Parkar
vgparkar.TakeThisOut@yahoo.co.in



"Queryless in SLC" wrote:

> I have a table that has a Sales Tax Code and an Invoice Date (ex. 7/04/07)
> and another table that has the Sales Tax Code, Tax Rate, and Effective Date.
> The second table can have the same Sales Tax Code with a different Tax Rate
> and Effective Date. I want to select only one Tax Rate record from the
> second table and that is the one that has the greatest effective date that is
> also less than the invoice date.
>
> I have tried the Top 1 method in a join and where statement, but it is not
> actually limiting the records from the second table.

 >> Stay informed about: Join Tables that don't have exact matches 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Join syntax? - I'm not sure if this is a join problem or even if it can be done. The english part of the query will be requesting cagegoires="Cat2" and return the matching records in table1, plus return all the other categories that belong to the set in ta...

Conditional Join - What I have are two different tables that I am going to join. Everything in the first table should be pulled. The second table should only pull the information when the field ACTION equals the word "ORDERED". Is there a way to join two ta...

Join on IP Addresses - If this has been answered already, or is better answered somewhere else, then please let me know. I need help with a query. I have a table with many fields of information about servers and network equipment. IP address is the Primary Key. I am ..

Left Outer Join Only Including Matching Rocords - I am executing the following SQL statement in Management Studio in a SQL Server 2005 environment: Select wl.wmslocationid,il.itemid,il.citullcastartpickinglocation,il.citullcaendpickinglocation from wmslocation wl left outer join inventitemlocation il....

GROUP BY's on 3 tables in one SELECT? - Hi there, I'd like to ask you for help with following: having 3 tables: T1 (Person_ID, Product_ID, Costs) T2 (Person_ID, Product_ID, Balancies) T3 (Product_ID, Product_Type) I have simple GROUP BY query: SELECT T1.Person_ID, T1.Product_ID, MAX(Costs)..
   Database Forums (Home) -> MSEQ All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]