SQL Column Counting Days Since Date [closed] - sql

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I'm currently a novice sql user with relatively low (self-taught) knowledge.
I currently have a query whereby I can view the contract start date of our clients. What I would like, is a custom column showing the number of days post contract start date. For example:
Start Date | Days Since Contract Start
04/02/2016 | 404 days
Please could somebody show me how this is possible?
Thanks!
Dan

Have you tried anything? As pointed out by Johns comments, this is not enough information for a good question. However I am presuming you want the DateDiff function....
Like so in MySQL;
DateDiff(StartDate, CURRENT_DATE())
Or
DateDiff(StartDate, GetDate())
in MSSql

Related

How to find the last non-null value from an account that is closed currently? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 days ago.
Improve this question
I am trying to figure out how I can retrieve the last balance of an account that is now closed so I can see how much money was left in their account before they closed it. I am trying to figure out how to write a SQL query for this. I have a table called Accounts that has the following columns: AccountNumber,Balance,Production Date,ClosedDate,Balance . I'm not sure how I can go back into time and retrieve users balances in their accounts while also pulling the same ones that are now closed. Any ideas?!
I haven't tried much because everything has failed currently. I'm thinking some type of CTE clause might do it?!

BigQuery SQL, CASE WHEN/ IF question about code editing. Easy level [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
Does anyone know how to edit this code to make it work? It's my first CASE WHEN. I'm trying to do it same way like another language but maybe I'm wrong. I want to do this "if" 3 times but now I will be happy if know how to do 1st. Ty for help!
code,
table column name
I can't see anything wrong with the case itself.
Your group by might need work though.
Try changing your group by to this:
group by email, priority

ERD for Payroll [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
I am attempting to build a database for a company's payroll system. I have worked on an ERD and my main concerns revolve around the loops, reimbursement table and possible weak entities.
I haven't done much of these and could use your help.
Thanks.
Link to ERD: ERD for Payroll
I would probably change the user to user_login. and remove loan_payment and reimbursement and just simply have a payment table. This could hold similar values but also include a payment type that would include its values like 'reimbursement' or 'work payment' because like you said reimbursement doesn't need to be its own table.

Outlook calendar script to look for date/time suggestions [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I know Outlook can suggest dates when planning a meeting. However, I would like to write more sophisticated scripts matching my exact requirements. For example: "Find the next available meeting date/time on a Tuesday or Thursday afternoon lasting three hours, where all obligatory participants and at least 50% of the optional participants and at least one of the specified rooms are available".
Is that possible? If so, how?
Call Recipient.FreeBusy or AddressEntry.GetFreeBusy to retrieve f/b data, then pick up the available slot.

API for what happened on this day? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
Is there an API which can be used to get data about what happened On this day in history .
Like the wikipedia home page shows On this day these events happened in history and these are the birthdays today ?
Wikipedia produces this data based on the extensive data and tagging of articles etc in its DB. Your best bet is probably going to be to scrape a wiki page that shows this.
Note: Don't fall foul of copyrights etc ! - There I said it. Can't get sued now!
Update 2021:
As mentioned by #sagun-raj-lage, it looks like there is now an API you can use officially, with an endpoint for onthisday: see https://en.wikipedia.org/api/rest_v1/#/Feed/onThisDay