By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,851 Members | 1,603 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,851 IT Pros & Developers. It's quick & easy.

Comparing 2 fields in 1 table

P: n/a
Hello.
I have a table like this

Name Item Amount
SB37 Water 100
SB37 Earth 50
SB38 Water 1
SB38 Earth 5
SB39 Water 1000
SB39 Earth 500
How can write a query such that only those Items from SB37 and SB39,
with Amounts more than 10 times that of SB38 are displayed?

In other words: Display record (Name/Item/Amount) if Amount is 10x
SB38 (corresponding Item).

Thanks for any input,
Nate

Dec 12 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
na***@twcny.rr.com wrote:
Hello.
I have a table like this

Name Item Amount
SB37 Water 100
SB37 Earth 50
SB38 Water 1
SB38 Earth 5
SB39 Water 1000
SB39 Earth 500
How can write a query such that only those Items from SB37 and SB39,
with Amounts more than 10 times that of SB38 are displayed?

In other words: Display record (Name/Item/Amount) if Amount is 10x
SB38 (corresponding Item).

Thanks for any input,
Nate
(air SQL):

SELECT [Name], Item, Amount FROM mytable WHERE Amount (SELECT
A.Amount FROM mytable AS A WHERE A.[Name] = 'SB38' AND A.Item =
mytable.Item) * 10;

James A. Fortune
CD********@FortuneJames.com

Dec 14 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.