-1

Not sure how to fix this error

Incorrect parameter count in the call to native function 'DATE_FORMAT'

Code:

SELECT 
    id, user_id, client_name, client_phone, 
    (SELECT name
     FROM users_permissions
     WHERE users_permissions.user_id = contracts.assistant_id) AS Consultant
FROM 
    contracts
WHERE 
    contracts_statuses IN (1, 2) 
    AND transaction_type = 'rent'
    AND DATE_FORMAT('%Y-%m') > '2017-08'
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Bar12345
  • 13
  • 1
  • 7

2 Answers2

1

You need to add the date column to date_format, like DATE_FORMAT(contracts.date, '%Y-%m')

Jay
  • 2,123
  • 1
  • 22
  • 29
1

The DATE_FORMAT() function formats a date as specified by a format mask.

syntax : DATE_FORMAT(date, format_mask)

so in this case you specifiy the date which needs to be masked with the required format. i.e :'%Y-%m'

Ramji
  • 375
  • 2
  • 14