Jump to content

jtelo

New Members
  • Posts

    8
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

jtelo's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I'm not an expert in this matter, but the query only returns the proper results this way. SELECT distinct `discipline` FROM `books` WHERE `year`="1" OR `year`="Pré-escolar" Only returns the discipline of of 'pré-escolar'. SELECT distinct `discipline` FROM `books` WHERE `year`=1 OR `year`=Pré-escolar Shows an SQL error: #1054 - Unknown column 'Pré' in 'where clause' SELECT distinct `discipline` FROM `books` WHERE `year`=1 OR `year`="Pré-escolar" Works!
  2. discovered the problem. The numbers had quotes in numbers. The correct syntax is the following: SELECT distinct `discipline` FROM `books` WHERE `year`=1 OR `year`="Pré-escolar"
  3. Thank you for the quick reply, but i'm getting the same result with both of your suggestions. I've more rows on that table with more years. If i make this query only with numbers, it returns the disciplines of both years. SELECT distinct `discipline` FROM `books` WHERE `year`='1' OR `year`='2' But with 'pré-escolar' and a number it doesn't work.
  4. Hi! I've a table 'books' with this data: yeardiscipline pré-escolargeometry 1math 1english I'm trying to do a mysql query to return the distinct disciplines with the year 'pré-escolar' and '1'. I've tried with SELECT distinct `discipline` FROM `books` WHERE `year`="Pré-escolar" OR `year`="1" But it only returns 'geometry'. Can someone help me? Thx.
  5. Thank you all for the help. I got what i wanted with this: select * from table where `date` BETWEEN DATE_SUB(CURDATE(), INTERVAL 1 DAY) AND CURDATE()
  6. With this i get all the rows of the previous days, but can't make it return only one day: SELECT * FROM table WHERE date<NOW()
  7. I have a table with the columns code, user and date (in the timestamp format. Example: 2010-07-09 11:23:42). I'm trying to make a query with PHP and mySQL to return the rows with the timestamp of the previous day, but can't make it work. Can someone please help me?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.