Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 left help

Author  Topic 

masond
Constraint Violating Yak Guru

447 Posts

Posted - 2012-08-01 : 13:27:36
Hi guys and girls

I need some more help to match different tables together
I need a logic to say whats the postcode in query1, and return the rm in query 2

however i if the rm_sales_band is between 2m-4m, ignore the postcode logic and apply the name TEST,

If the value is 4m+ then apply the postcode logic

Within query 2, pca there can either be 1character or two.

Eg pca

AB = Aberdeen
B = Birmingham


please find attached two screen prints
Query
query2

lookign forward to your help

ps i have two screen prints i want to upload, but i dont know how to do it. any suggestions ?

robvolk
Most Valuable Yak

15732 Posts

Posted - 2012-08-01 : 13:42:19
Use imgur: http://imgur.com/

Once you upload your images there, copy the links and paste them into your post.
Go to Top of Page

masond
Constraint Violating Yak Guru

447 Posts

Posted - 2012-08-01 : 13:48:40
hi

Please find attached links, there should be two screen prints
query and query2

http://imgur.com/gqkND,rQ4Ql
Go to Top of Page

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2012-08-01 : 14:59:31
Here are some links that can help you prepare your question along with sample data (DDL & DML) as well as expected results. It is much easier for us non-paid people willing to help you with your questions if you provide the basiscs as described in these links:
http://bi-polar23.blogspot.com/2007/08/loading-multiple-excel-files-with-ssis.html
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


As a side, note.. I assume you are already locked into your schema, but column names like RM and PCA are not very good names. "Object" names should be much more descriptive. You might be interested in ISO 11179 for how to name things:
http://metadata-standards.org/11179/
Go to Top of Page
   

- Advertisement -