SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Pull some data from unrelated table
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Kelapa
Starting Member

Turkey
8 Posts

Posted - 04/08/2013 :  09:47:51  Show Profile  Reply with Quote
I have a difficulty which tied me up that not to get a decent report from the below issue. As you can see there are some highlighted rows on the screen capture image that shows those rows' data related another table but I can't build a relation with both to pull from another field of that table as T1, T2, T17, T16, T3, T18, T4, T6, T19 and T5 all those field's definitions are in another table. So how can I write a decent script to get those codes' definicition from another table.

TG
Flowing Fount of Yak Knowledge

USA
6062 Posts

Posted - 04/08/2013 :  14:37:54  Show Profile  Reply with Quote
Do you know what table or tables holds the definition to these codes (T18, T4, etc)?
You will need to add that table to your FROM clause with the correct correlation to be able to include the definition in your SELECT column list.




Be One with the Optimizer
TG
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52317 Posts

Posted - 04/09/2013 :  00:07:55  Show Profile  Reply with Quote
One more thing to note is that you're using Pervasive SQL and this is MS SQL Server forum. So there wont be too many people with exerience in pervasive sql. so you may be better off posting this in some ms sql server forums

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

Kelapa
Starting Member

Turkey
8 Posts

Posted - 04/09/2013 :  03:36:17  Show Profile  Reply with Quote
quote:
Originally posted by visakh16

One more thing to note is that you're using Pervasive SQL and this is MS SQL Server forum. So there wont be too many people with exerience in pervasive sql. so you may be better off posting this in some ms sql server forums

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs



Its clear to see that here is a SQL forum as at the top of left corner. Not only MS Sql.
Sql is a common language, wink
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52317 Posts

Posted - 04/09/2013 :  04:10:22  Show Profile  Reply with Quote
quote:
Originally posted by Kelapa

quote:
Originally posted by visakh16

One more thing to note is that you're using Pervasive SQL and this is MS SQL Server forum. So there wont be too many people with exerience in pervasive sql. so you may be better off posting this in some ms sql server forums

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs



Its clear to see that here is a SQL forum as at the top of left corner. Not only MS Sql.
Sql is a common language, wink


Here we deal only with ms sql server.
There are very few people (if at all) with experience in Pervasive SQL
So solutions given here cannot be guaranteed to work well in any other RDBMS
SQL is common language but implementation has some syntactical difference in various products like Oracle,Teradata, etc

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs

Edited by - visakh16 on 04/09/2013 04:11:25
Go to Top of Page

Kelapa
Starting Member

Turkey
8 Posts

Posted - 04/10/2013 :  01:03:48  Show Profile  Reply with Quote
quote:

Here we deal only with ms sql server.
There are very few people (if at all) with experience in Pervasive SQL
So solutions given here cannot be guaranteed to work well in any other RDBMS
SQL is common language but implementation has some syntactical difference in various products like Oracle,Teradata, etc


Yes, I'm agree with your words. If I typed my words and the script as MS SQL then nobody sees the difference and might answer to my question.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52317 Posts

Posted - 04/10/2013 :  01:11:06  Show Profile  Reply with Quote
quote:
Originally posted by Kelapa

quote:

Here we deal only with ms sql server.
There are very few people (if at all) with experience in Pervasive SQL
So solutions given here cannot be guaranteed to work well in any other RDBMS
SQL is common language but implementation has some syntactical difference in various products like Oracle,Teradata, etc


Yes, I'm agree with your words. If I typed my words and the script as MS SQL then nobody sees the difference and might answer to my question.


yep...but you cant still guarantee that given solution will work for you especially if it contains some SQL Server specific syntax.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

Kelapa
Starting Member

Turkey
8 Posts

Posted - 04/10/2013 :  01:43:06  Show Profile  Reply with Quote
Anyway, I solved my query issue that works well with the below. Thanks

SELECT 
   BOMU01T.BOMREC_KAYNAKCODE,
   IF(IMLT00.AD IS NOT NULL, IMLT00.AD,STOK00.AD),
   BOMU01T.BOMREC_KAYNAK0,
   IF(IMLT00.UNITS IS NOT NULL, IMLT00.UNITS, STOK00.IUNIT)
FROM BOMU01T LEFT OUTER JOIN STOK00 ON BOMU01T.BOMREC_KAYNAKCODE = STOK00.KOD
   LEFT OUTER JOIN IMLT00 ON BOMU01T.BOMREC_KAYNAKCODE = IMLT00.KOD
WHERE BOMU01T.BOMREC_CODE = 'AE 5 17,5 A1 ED 12 3'
ORDER BY BOMU01T.SRNUM
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.14 seconds. Powered By: Snitz Forums 2000