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 8299975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T16:22:21+00:00 2026-06-08T16:22:21+00:00

I am trying to create a SQL query that will select everything shown…but I

  • 0

I am trying to create a SQL query that will select everything shown…but I have a condition where the total hours !=0. This works but I must add one more condition that would exclude the condition of total hours !=0.

I basically need the query to look like: AND project_timecard_task_days.total_hours != 0 UNLESS task.type =”Fixed Rate”

So, the “unless” part of the statement is the issue. Any help will be much appreciated!

SELECT project_timecard_tasks.task_id, 
       project_timecard_tasks.datetime, 
       project_timecard_tasks.total_hours, 
       project_timecard_tasks.user_id, 
       project_timecard_tasks.project_id, 
       users.user_id, 
       users.firstname, 
       users.lastname, 
       users.billingrate, 
       tasks.id, 
       tasks.taskname, 
       tasks.billingoption, 
       tasks.fixedrate, 
       tasks.rate_schedule_id, 
       hourlyrates.rate_schedule_id, 
       hourlyrates.hourlyrate, 
       project_timecard_tasks.project_task_id, 
       project_timecard_task_days.project_task_id, 
       project_timecard_task_days.project_task_day_id, 
       project_timecard_task_days.total_hours, 
       project_timecard_task_days.comments, 
       project_timecard_task_days.invoiced 
FROM   project_timecard_tasks 
       JOIN users 
         ON project_timecard_tasks.user_id = users.user_id 
       JOIN tasks 
         ON project_timecard_tasks.task_id = tasks.id 
       JOIN project_timecard_task_days 
         ON project_timecard_tasks.project_task_id = 
            project_timecard_task_days.project_task_id 
       JOIN hourlyrates 
         ON project_timecard_tasks.billing_code_id = hourlyrates.hourly_rate_id 
WHERE  project_timecard_tasks.project_id = '$jobNumber' 
       AND project_timecard_task_days.total_hours != 0 
       AND project_timecard_task_days.invoiced != 1 
  • 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-06-08T16:22:22+00:00Added an answer on June 8, 2026 at 4:22 pm
    ...AND (project_timecard_task_days.total_hours != 0 OR task.type ="Fixed Rate")...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write a custom SQL query that will create a list of
im trying to create a sql query, that will detect (possible) duplicate customers in
I'm trying to create a query on SQL server 2005 that will check if
I am trying to create a query in MS SQL 2005 that will return
I'm trying to create an SQL query that will order the results by a
I am trying to create an HQL query that will filter a tree based
So I'm trying to create a function that generates a SQL query string based
I am trying to write a procedure that will fire the same select query
I am trying to write a SQL statement that will create a flattened table
I'm new to SQLite3 with iOS I'm trying to create an SQL Query that

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.