vendredi 31 juillet 2015

New To MySql Nested Query

I have 2 tables that I'm trying to pull data from:

  • USER
  • USER_NAME

USER has the following indexes:

  • ID
  • ORG_ID
  • DEFAULT_EMAIL_ID
  • STATUS
  • NAME
  • CREATED
  • UPDATED

USER_NAME has the following indexes:

  • ID
  • USER_ID
  • STATUS
  • TIMEZONE_ID
  • DST
  • LANG
  • USERNAME
  • PASSWD
  • BACKEND
  • REGISTERED

My goal is to get USERNAME from USER_NAME and NAME from USER. My background is more in DB2. I'm just learning MySQL. I tried the following with no luck.

select NAME from OST_USER where ID in (select ID, USERNAME from OST_USER_ACCOUNT where CREATED < '2015-07-09');

Any idea what I can do to get the info? Is it even possible with the given indexes? Any help is really appreciated!

Aucun commentaire:

Enregistrer un commentaire