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
 Script Library
 Need help with a query

Author  Topic 

jtiago
Starting Member

1 Post

Posted - 2013-02-28 : 05:36:44
i need to write a query from one table but with elements from documents with diferent internal numbers.

how can i relate the two diferent internal numbers of documents on the query?

select bo.orinopat as 'N PAT',
bo.no as 'Cliente',
bo.nome as 'Nome Cliente',
bo.fref as 'N OBRA',
bo.obrano as 'N FObra',
bo.dataobra as 'Data FObra',
bo.datafecho as 'Dt Fecho FO',
bo.vendnm as 'Comercial',
bo.ecusto as 'Custo FObra',
bo.etotaldeb as 'Valor Venda',
((((bo.etotaldeb-bo.ecusto)*100))/bo.etotaldeb) as 'Margem Percent'
From bo
Where bo.ndos like 32


(Select bo.orinopat as 'N PAT',
bo.no as 'Cliente',
bo.nome as 'N Cliente',
bo.obrano as 'N Orç',
bo.dataobra as 'Data Orç',
bo.datafecho as 'Dt Fecho Orc',
bo.vendnm as 'Comercial',
bo.datafinal as 'Dt Adj',
bo.etotaldeb as 'Total Venda',
bo.ecusto as 'Custo Previsional',
bo.u_cpag as 'Cond Pag 1',
bo.u_evala as 'Euros Cond Pag 1',
bo.u_cpaga as 'Cond Pag 2',
bo.u_evalb as 'Euros Cond Pag 2'
From bo
Where bo.ndos like 11)

JTiago

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-02-28 : 06:34:59
Where bo.ndos IN (32,11,.. other values if any)

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -