Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6156611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:38:26+00:00 2026-05-23T20:38:26+00:00

Pls i have the following code in my model Letter.count(:id, :conditions => [language_id =

  • 0

Pls i have the following code in my model

Letter.count(:id, :conditions => ["language_id = #{lang} AND :created_at => '#{start_date.to_date.strftime('%Y-%m-%d')}'..'#{end_date.to_date.strftime('%Y-%m-%d')}' " ])

I am trying to get the count of letters.id of different letters between the given dates.
This is the error an having…

Please those anyone know what am doing wrong…Thanks

SQLite3::SQLException: near ">": syntax error: SELECT COUNT("letters"."id") FROM "letters" WHERE ("letters".language_id = 1) AND (language_id = 1 AND :created_at => '2011-05-01'..'2011-05-08
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T20:38:27+00:00Added an answer on May 23, 2026 at 8:38 pm

    This can be much simplified. A couple points:

    1. You don’t use the :created_at => ... format within a string
    2. You need to use between ? and ? for dates.
    3. You don’t need to manually strftime your dates, Rails will handle this automatically.
    4. In Rails 3, the preferred way is to use where(...) instead of a :conditions Hash for your count(...).
    5. You should probably use Rails’ safe interpolation for your language_id field too

    Letter.where("language_id = ? AND created_at between ? and ?", lang, start_date.to_date, end_date.to_date).count

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i'm learning sicp now and do the ex2.23 i have wrirten the following code:
I am getting undefined method `member' error in my following code Pls tell where
.I have the following code. I am wondering why does my echo '<font color=#FF0000>'.$update_date2.'</font><br><br>'.$status.'<br>';
i have executed the following code public class Activity_Threads_Handler extends Activity { private int
pls look at following piece of code. for (int j = 0; j <
I have the following code.. and I know it's probably all wrong, but I
I have the following code: function loadTweets() { $('#mainForm').submit(function(){ return false; }); $('#send').click(function(){ $('#tweets').html('');
Pls check code .html form gets submitted even if javascript returns false. <form id=form1
I have the following entities Alert and Location in Grails. But I cant seem
I have tried the following: var getAllResponse = new GetAllResponse(); // Prime the GetAll

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.