ms access - Get all the multiple transactions on the last date of each account in sql -


any appreciated. have table fields "salesmanid", "transdate", "brand", "quantity" , "total". want all transactions of particular salesman last date.
sample:

|transaction date | salesmanid | brand | quantity | total |   6/3/2015               101      le123      2       1000   6/3/2015               101      go123      1       500 

i have code give me all transactions of salesman including previous dates.

 select max(transdate) [transaction date], brand, quantity, total  dailysalesreport  salesmanid = ?  group brand, quantity, total 

sample:

|transaction date | salesmanid | brand | quantity | total |   6/3/2015               101     le123      2       1000   6/3/2015               101     go123      1       500   6/2/2015               101     mn12       5       2000 

i need transactions of 1 salesman on last date. thanks.

you need specify max transaction date in clause.

select transdate [transaction date], brand, quantity, total dailysalesreport salesmanid = ? , transdate = (     select max(transdate)     dailysalesreport     salesmanid = ?) 

Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -