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 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

StackOverflow Point

StackOverflow Point Navigation

  • Web Stories
  • Badges
  • Tags
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Web Stories
  • Badges
  • Tags
Home/ Questions/Q 1666
Alex Hales
  • 0
Alex HalesTeacher
Asked: May 30, 20222022-05-30T23:02:31+00:00 2022-05-30T23:02:31+00:00

sql – filter values showing a complete column

  • 0

[ad_1]

I have created this table with this piece of code

select *, round(Total_Subj_SFd/nullif((Total_Actual_of_Patients_Screened-"# of Subj in Screening"),0)*100,2) as "Current SF %"

from

(select *,  Total_Actual_of_Patients_Screened - Total_Actual_of_Patients_Randomized - Total_Subj_SFd  as "# of Subj in Screening",

cast(coalesce(cast(Weekly_Actual_of_Patients_Screened as float)/nullif(Weekly_Proj_of_Patients_Screened,0)*100,0)as int)as "Weekly % vs Plan Screened",

coalesce(round((Total_Actual_of_Patients_Screened/nullif(Total_Proj_of_Patients_Screened,0))*100 ,2),0) as "Total % vs Plan Screened",

cast(coalesce(cast(Weekly_Actual_of_Patients_Randomized as float)/nullif(Weekly_Proj_of_Patients_Randomized,0)*100,0)as int) as "Weekly % vs Plan Randomized",

coalesce(round((Total_Actual_of_Patients_Randomized/nullif(Total_Proj_of_Patients_Randomized,0))*100 ,2),0) as "Total % vs Plan Randomized"

from


(select
distinct(ivd.date) as Week_Ending_Date,
--sid.siteid as "Site",

wscproj.nume as Weekly_Proj_of_Patients_Screened,

coalesce(ev.count,0) as Weekly_Actual_of_Patients_Screened,

sum(wscproj.nume) over (order by ivd.date) as Total_Proj_of_Patients_Screened,

coalesce(sum(ev.count) over (order by ivd.date),0) as Total_Actual_of_Patients_Screened ,

wscproj2.nume2 as Weekly_Proj_of_Patients_Randomized,

coalesce(ire.c1,0) as Weekly_Actual_of_Patients_Randomized,

coalesce(sum(wscproj2.nume2) over (order by ivd.date),0) as Total_Proj_of_Patients_Randomized,

coalesce(sum(ire.c1) over (order by ivd.date),0) as Total_Actual_of_Patients_Randomized,

coalesce(sum(sf.count) over (order by ivd.date),0) as Total_Subj_SFd,

coalesce(sf.count,0) as "Weekly # of Subj SFd",

psfproj.psf1n as "Predicted SF %"

from

enter image description here

and I am filtering by a site parameter

where ((sid.siteid = ?) or (? = '[all]')) and ivd.date <= current_date::timestamp 
order by ivd.date

to obtain this
enter image description here

enter image description here

but they ask me that with the site filter I give all the dates from Nov 19, 2021 to the current one and the sites that did not have a response that day come out with 0 and those that do are filled in as in the previous table

help): thanks

[ad_2]

  • 0 0 Answers
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report
Leave an answer

Leave an answer
Cancel reply

Browse

Sidebar

Ask A Question

Related Questions

  • xcode - Can you build dynamic libraries for iOS and ...

    • 0 Answers
  • bash - How to check if a process id (PID) ...

    • 5379 Answers
  • database - Oracle: Changing VARCHAR2 column to CLOB

    • 1169 Answers
  • What's the difference between HEAD, working tree and index, in ...

    • 1111 Answers
  • Amazon EC2 Free tier - how many instances can I ...

    • 0 Answers

Stats

  • Questions : 43k

Subscribe

Login

Forgot Password?

Footer

Follow

© 2022 Stackoverflow Point. All Rights Reserved.

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.