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
 Pull some data from unrelated table

Author  Topic 

Kelapa
Starting Member

8 Posts

Posted - 2013-04-08 : 09:47:51
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
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2013-04-08 : 14:37:54
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

52326 Posts

Posted - 2013-04-09 : 00:07:55
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

8 Posts

Posted - 2013-04-09 : 03:36:17
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

52326 Posts

Posted - 2013-04-09 : 04:10:22
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
Go to Top of Page

Kelapa
Starting Member

8 Posts

Posted - 2013-04-10 : 01:03:48
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

52326 Posts

Posted - 2013-04-10 : 01:11:06
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

8 Posts

Posted - 2013-04-10 : 01:43:06
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
   

- Advertisement -