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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

If/Else statement

Status
Not open for further replies.

rickyshah

MIS
Jun 15, 2005
8
GB
Hi All

I need help in writing an If or Else statement for the following data.

Have 2 variables (Store Number and Type):

Example of layout:
Store Number Type
123456789 R
123456789 S
987654321 S

What I want the statement to be able to do is if the storenumber has both a row with R and S, to pick the row with R. Alternatively if there is only one entry per storenumber like the 987654321 then to pick the type S for that.

Thanks in advance

Ricky
 
Ricky,
Code:
SELECT `Sheet3$`.`Store Number`, Min(`Sheet3$`.Type)
FROM `D:\My Documents\vba\RPT_Schedule-06_07_05`.`Sheet3$` `Sheet3$`
GROUP BY `Sheet3$`.`Store Number`


Skip,

[glasses] [red]Be advised:[/red]When Viscounts were guillotined just as they were disclosing where their jewels were hidden, it shows to go that you should...
Never hatchet your Counts before they chicken! [tongue]
 
Hi Skip,

Thanks for the tip, but is there a way to insert this in An access query in design view as I am not too familiar with SQL.

Thanks.
 
Hi Skip,

Don't worry think I've got it, used the MIN option when grouping the data.

Thanks.

Ricky
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top