0

How to join two table table with different data types? in the first table status field type is enum and in second table it is int, how i can join these tables

3
  • 3
    Could you give an example of what the tables look like? (schemas/contents) Commented Apr 19, 2012 at 12:42
  • 2
    Really it should just be an INT in both columns. Normally an ENUM would be used for storing strings where there are only specific strings used. Commented Apr 19, 2012 at 12:42
  • Just try the with joins on those columns and see if there is any issue. ENUM values are anyways integer and so should not be a issue joining them with a int field (That's a Guess though). Commented Apr 19, 2012 at 12:45

1 Answer 1

1

Enum type is stored by MySQL as an int, so you can do the join as usual. But in case both fields were different you should cast one of them to make their types match if possible (usually with cast functions http://dev.mysql.com/doc/refman/5.0/en/cast-functions.html)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.