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
 way to format this query

Author  Topic 

AdamWest
Constraint Violating Yak Guru

360 Posts

Posted - 2013-10-22 : 22:37:51
I have to fetch some rows within a Crystal report. I need to select
from Orderhist a where
order# a = order# cr
and trncde is in 'pwb' 'pdb' 'pbb'

but i need then that trncde as a report field. also the order# cr is a formula field because its a subscript embedded 8 char within a 24 char. this is already available to the cr but can u do the where = on a formula field?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-10-23 : 01:28:42
you can if you make the query into derived table you can use it like below


select *
from
(
...
from Orderhist a
where
order# a = order# cr
and trncde in ('pwb','pdb','pbb')
)t
WHERE ..


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

- Advertisement -