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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 querying the same

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-07-26 : 09:20:19
bobby writes "how do i query the same table with multiple search criteria?
i have a table t1 that contains....
stock number nomenclature qty location
I have a second table t2 with due out info for the stock number in t1 above. It contains....
stock number document nbr duo qty
when these two match, the last portion of the nomenclature in t1 also contains a stock number which i need to see if it is loaded in t1 with a qty

select ir.sran, ir.[stock number], ir.errc, ir.[iex code] as [ix]
ir.[rex code]as [rx], ir.[acquisition advice code]as [aa],
ir.nomenclature, ir.[serviceable balance]as [o/h qty],
do.[document nbr], do.[duo qty]
from [item record] ir
where ir.[rex code] = '4' and ir.[stock number] in (select do.[stock number]
from [due out detail] do left join [item record] ir on
ir.sran = do.sran and ir.[stock number] = do.[stock number]
where substring(ir.[nomenclature nbr],1,3) = 'use' inner join
[item record] ir on substring(ir.[nomenclature,5,15])=ir.[stock number]"

setbasedisthetruepath
Used SQL Salesman

992 Posts

Posted - 2002-07-28 : 13:53:07
Hi Bobby,
Many reads but no replies usually means your audience is confused. I admit I am too; it's unclear what you're specifically asking. Do the following and we'll help you out:

(1) Post DDL (critical!).
(2) Explain in greater detail what the query you posted is supposed to do, and what relevance it has to your question.
(3) Get rid of those spaces in your column names! You'll drive yourself crazy escaping them with [] symbols all day long.

Jonathan Boott, MCDBA
Go to Top of Page
   

- Advertisement -