MySQL Forums
Forum List  »  Newbie

DATE
Posted by: T M
Date: December 11, 2017 07:56AM

Hi forum,

I've got a task to extract some data and I'm not sure how to go about it.
I've got 2 tables: LOGIN and STOCK_MOVEMENT.

LOGIN columns:
USER,
LOGIN_DATE,
IP_ADDRESS

STOCK_MOVEMENT columns:
MOVEMENT_ID,
PRODUCT_ID,
PRODUCT_NAME,
UNIT_PRICE,
QUANTITY,
DATE_IN_ACCOUNT,
DATE_RELEASED

Every time a user logs in, they can see the prices for all products that are in their account. It's easy enough to link up the two tables on USER, but LOGIN DATE needs to be between DATE_IN_ACCOUNT and DATE_RELEASED.

I've tried writing the condition as:

WHERE (LOGIN_DATE BETWEEN DATE_IN_ACCOUNT AND DATE_RELEASED)

and several variations of the above condition, but in the end I get nothing.

I just want the following columns returned:
USER, LOGIN_DATE, PRODUCT_NAME

Any ideas?

Thanks!

Options: ReplyQuote


Subject
Written By
Posted
DATE
T M
December 11, 2017 07:56AM
December 11, 2017 09:40AM
T M
December 11, 2017 11:42AM
December 11, 2017 11:53AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.