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
 Script Library
 Need help with a query
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

jtiago
Starting Member

Portugal
1 Posts

Posted - 02/28/2013 :  05:36:44  Show Profile  Reply with Quote
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

India
52309 Posts

Posted - 02/28/2013 :  06:34:59  Show Profile  Reply with Quote
Where bo.ndos IN (32,11,.. other values if any)

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

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.03 seconds. Powered By: Snitz Forums 2000