« first day (1498 days earlier)      last day (2820 days later) » 

3:57 AM
Anyone know File Maker Pro Database here?
I need help for my project.
I want to update my existing record but its not working.
$edit = $fm->newEditCommand('accounts', 39350, $values);
$result = $edit->execute();
That is my code to update any help guys, thanks a lot
 
 
2 hours later…
5:33 AM
select count(*) from table_1 where userid in (34832575, 34801735, 34816575, ......)


What if there is a very long number of elements? Possible to take them from an external file?
 
 
7 hours later…
12:45 PM
@Dawny33 Insert them into a temp table and either LEFT JOIN, EXCEPT, NOT IN(SELECT <column_name> FROM #temp_table)
Whatever one you like, know the most, most performance gain for you
 
 
5 hours later…
5:46 PM
is anyone here?
i need a help regarding sql
 
@ARr0w help regarding sql (SQL Server), sql (MySQL), sql (PostgreSQL)?
 
Sql server
i have posted the question, but it has not been answered.
here on chat, i will able to easily define what i am looking for (live chat is way better)
 
@ARr0w eh...kinda...questions are easier for examples and stuff
chat is easier for clarification and comments
share the link to the question so
 
yeah, but, two people commented, i replied to their comment but now they are dead -_-
okay and please do read my comments and if still there is any thing which confuses you ask me here, please. I'll appreciate it.
1
Q: SQL Server - Store/save DateDIFF via SQL server agent

ARr0wi want to store the fetched difference from the query to the Attendance table via update query. so far I have a table Attendance AttendanceId UserId AttendanceStatus Hours CheckIn/Out DateTime --------------------------------------------------------------------- 1 22 Pres...

 
okay...so regardless of the whole tagged as `mysql` when it's a `sql-server`cause that's already be said.
It's a bit confusing but is the crux of the problem this:
* If the `Hours` difference is >= 4 then 4
* otherwise leave it as it is?
 
6:00 PM
listen
sorry for the mysql tag. im a newbie
i want to run a job on every hour
in sql server agent
where i want to

check the people who are 'present' and their 'DateTime' (note: the datetime was noted when they 'checkedin' to mark their attendance
by noted i meant the 'datetime' column stores the time of the checkin
now i wanted to get the difference of their working hours
from the DateTime (when they checkedIn) with the current DateTime
which i managed to get via query that is in the question
now that i have multiple rows in 'Hours_Difference' because there were multiple people checkedin
so, i want these values in multiple rows in Hours column of the attendance table
multiple rows of Hours_difference in hours column*
how do i do this?
did i clear my point now?
 
6:16 PM
I ...think...so
I get you're a newbie so don't worry about the `mysql` tag
but it would really help everyone if we could narrow down what you want into 1 clear sentence.
"I want to update the table attendence so that the [Hours_Difference] is equal to the difference in minutes from when they checked in, recorded in the [DateTime] column and GETDATE()"
Is that it
 
yes
 
Brilliant!
 
im going to cry if this satisfies me lol
 
@ARr0w BAHAHAHAHA!!
now a question for you, do you need a SQL Server Agent Job for this?
We can do that but it's not needed
 
yes, brother, i do.
 
6:21 PM
@ARr0w Okay, then I think what you need is a MERGE statement
Give me a bit and I'll create an example for you
 
sure, brother, take your time.
the reason i am using sql server agent because, in my web application, daily max working hours is 4 and i am not using any timer. I'm storing in database after calculating time difference. But, what if the user forgets to checkout? in such case, i want a job in sql server agent that will run every hour and calculate the time difference . in case the hour difference reaches 4 or greater than 4 of any user, it will run a 'update query that you just defined above and put value '4'
brb
 
6:50 PM
@ARr0w Wait really? eh...can you change the table definition at all? Because then you can change [Hours_Difference] into a computed column and that could work for you.
 
7:04 PM
/*
AttendanceId  UserId  AttendanceStatus Hours CheckIn/Out DateTime
---------------------------------------------------------------------
     1          22         Present       0       In      2016-6-23 5:30:00
     2          23         Present       0       In      2016-6-23 5:30:00
     3          24         Present       0       In      2016-6-23 5:30:00
     4          25         Present       0       In      2016-6-23 5:30:00
	 */

CREATE TABLE dbo.Attendance
(
	AttendanceId		int,
	UserID				int,
 
 
2 hours later…
8:39 PM
ShaneIs, can you post this answer on my question, i want to rank you up (appreciation)
i love you man
but this is the half way, now the job will run and get the result to 4.
all i need is..
update Attendance set CheckInCheckOut = 'Out', Hours = *select DateTime, IFF(...)* where datetime = convert(date, getdate())

and it will work, right?
by the way i am sorry for showing up so late, i kinda was concluding the fight to turn things back to normal with my girlfriend.
 
You want to update the [Hours] to just 4 or update it to Getdate - DateTime?
No worries, no time limit on this for me
 
i just want to update [hours] to 4 (of current day of those users only of which your-query returns 4 or > 4)
i wish sql had this just like in c# -> datetime = 'GetDate("yyyy-MM-dd")%'
 
@ARr0w Have to learn c# but sounds useful
Why not update everything to 4?
update Attendance set CheckInCheckOut = 'Out', Hours = 4 WHERE DATEDIFF(MI, (SELECT IIF(ISDATE([DateTime]) = 1, CONVERT(DATETIME, [DateTime], 111), [DateTime]) > 4?
 
i have completed my final year project (almost) which is (automated payroll system with gps tracking system with crystal report). the thing left is the problem is which i am here for. I made it on asp.net (c#)
i may have learned 10% of c#, but now, i can work least to create a website.
its just im taking time in getting this sql server
and my project have attendance section
where employees 'checkin and checkout'. (yes my original table had/have 'checkInCheckOut' column
update Attendance set CheckInCheckOut = 'Out', Hours = 4 WHERE DATEDIFF(MI, (SELECT IIF(ISDATE([DateTime]) = 1, CONVERT(DATETIME, [DateTime], 111), [DateTime]) = 4, >4

here in sql the error appears (DateDiff requires 3 arguements)
---------------------------
update Attendance set CheckInCheckOut = 'Out', TotalHours = 4 WHERE DATEDIFF(MI, (SELECT IIF(ISDATE([DateTime]) = 1, CONVERT(DATETIME, [DateTime], 111), [DateTime])), GetDate())/60.0 > 4
--------------------
will this work?
 
9:02 PM
Sorry yeah, good catch, forgot the GETDATE() bit
 
dude im trying this. Btw, i love you man!
thank you for such a concentration!
how can i give you plus point here?
 
ha you can't man, but if someone needs help with c# and you can give them a hand, do it
Also, when you have this sorted, write up the answer, that help someone coming across your question
 
i rather will tell you to write an answer there. So that you earn points. You will post it i wont. You deserve it
and off course, i will help my friend.
where were i will be able to.
 
Tell you what, whenever you have a question and you get it answered, spend another 5 minutes and vote a question or answer up/down
or answer a question
You need help on another SQL question and nobody is answering it, share it here as well and someone will take a look
 
alright, i will, don't you worry, bro.
see this image.
the query changed the value of hours of old entries
i wanted it to change the values of rows which has 'In' and DateTime matches current day
the last entry is the date format i am getting from c#
so keep it in this way, the early entries changed the datetime format in rows of old entries when i changed the datetime datatype to datetime earlier
 
9:18 PM
okay how about adding this to the end of the update
and CONVERT(DATE, [DateTime]) = CONVERT(DATE, GETDATE())
that will limit it to only today's records
 
'update Attendance set CheckInCheckOut = 'Out', TotalHours = 4 WHERE DATEDIFF(MI, (SELECT IIF(ISDATE([DateTime]) = 1, CONVERT(DATETIME, [DateTime], 111), [DateTime])), GetDate())/60.0 >= 4 and [DateTime] = '2016-06-24%''

i tried this to check (cos i dont have current day record) , it worked but it didn't affect any row. (0 rows affected)
 
Yeah if a query is correct in terms of syntax but doesn't return any rows you get that (0 rows affected)
That's not going to work though since you have some records as "June 23%" and some as "2016-0%"
 
9:34 PM
ihttp://i.imgur.com/M6Puck6.png
see this one. read last three queries there i added
still no change. (0 rows affected)
it worked.
i forgot to change 'datetime =' to 'DateTime like '2016...%'
 
it worked? Great
Also that's what the comments were talking about with keeping DateTime as datetime data type :-)
 
well, it works now here as i can easily giving it '%' but will convert(Date, getdate()) ?
 
you mean can you do convert(date, getdate()) like '2016-06-15%'?
No but if you are searching for a date then you wouldn't need that, right?
 
yes (for current day)
cos, the DateTime datatype is nvarchar.
 
hahaha wow that's not the best data type for that!
ah no worries, what's done is done
if you do SELECT CONVERT(DATE, GETDATE())
you get 2016-06-24
 
9:41 PM
i kept it nvarchar cos, i searched the google and there is no help regarding Sql DateTime supporting this command used in C# `DateTime like '"+DateTime.Now.ToString("yyyy-MM-dd")+"%' :(
 
yeah that's probably true (I don't know C#) :-(
You could do a work-around though?
 
yeah, but the DateTime has HH:mm:ss so, it wont match right? cos it will be ' DateTime = convert(date, GetDate())
i will bro
you've helped me 99% <3
can you post the answer there. I want to mark it and give it a thumbs up
 
@ARr0w Actually it will, SQL Server will do an internal "implicit" conversion so if it can convert to a date it will
haha I'll do it tomorrow man, have to go out now
Best of luck
need any more help, leave it here and I'll get back to it eventually
 
Ill be waiting for it :*
will do
you takecare man!
nice talking to you!
have your rest!
and enjoyment along!
and apologies for the badenglish
you made it 100%. it worked as you said sql will do an internal implicit conversion. :*
 

« first day (1498 days earlier)      last day (2820 days later) »