Jump to content


Photo

Chapter 7 - Pg 288


  • Please log in to reply
1 reply to this topic

#1 andy2012

andy2012

    New Member

  • Members
  • Pip
  • 2 posts

Posted 17 June 2013 - 11:54 AM

Hi all,

I have tried the short exercise on pages 287 / 288 - Use only the first Interest.

However, I get a column that returns all Interests in the field not just the first one showing only 'Animals'.
I have double checked and treble checked the SQL code with the book and it seems fine:

SELECT * FROM my_contacts
WHERE gender = 'F'
AND status = 'single'
AND seeking LIKE '%single M%'
AND birthday > '1950-08-28'
AND birthday < '1960-08-28'
AND SUBSTRING_INDEX(interests, ',' ,1) = 'animals';

Any ideas?

Thanks Andy ;-)

#2 drewdin

drewdin

    Super Veteran Member

  • Members
  • PipPipPipPipPipPipPipPipPipPipPip
  • 608 posts
  • Gender:Male
  • Location:Boston

Posted 04 September 2013 - 08:55 AM

Hi all,

I have tried the short exercise on pages 287 / 288 - Use only the first Interest.

However, I get a column that returns all Interests in the field not just the first one showing only 'Animals'.
I have double checked and treble checked the SQL code with the book and it seems fine:

SELECT * FROM my_contacts
WHERE gender = 'F'
AND status = 'single'
AND seeking LIKE '%single M%'
AND birthday > '1950-08-28'
AND birthday < '1960-08-28'
AND SUBSTRING_INDEX(interests, ',' ,1) = 'animals';

Any ideas?

Thanks Andy ;-)


You're selecting everything from the row (*) for specific rows that have 'animals' in the interest.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users