Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query Question

Status
Not open for further replies.

ck1999

Technical User
Dec 2, 2004
784
US
I have a query with 4 columns

Name, Yes/No, Retail Wholesale

This is what I want the query to do

If wholesale <> 0 then display.
If yes/no = yes then display retail.

So after you run the query all will have the name however it will either display a wholesale or retail value.
Data is being pulled from qryprices
Anyone know how i can write the sql for this.

thank you

ck1999
 
Are you looking to display either the retail field value or the wholesale field value, but not both? Then take the Yes/No, Retail and Wholesale fields out of the query, and substitue a calculated field with this type of expression.

MyValue:IIf(Wholesale <> 0, [Wholesale], [Retail])

You can play around with this expression if it doesn't work exactly like you expect.

Paul
 

Possibly:
Code:
SELECT Name, YesNo, iif(YesNo = "Yes", [Retail], "") As Rtail, iif(YesNo = "No", [Wholesale], "") As WSale
FROM qryPrices


Randy
 
thank you both for your help I ended up using

WHERE (((queryPLcost.yesno)=True)) OR (((queryPLcost.wholesale)<>0)

ck1999
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top