Viewing 15 posts - 631 through 645 (of 7,614 total)
A trigger makes the most sense to me, so that the assignments are immediate. You would also need a DELETE trigger to remove interested / mutual for a deleted user_id...
September 29, 2022 at 11:08 pm
Btw, as noted by some others, I too, fortunately, have never seen any automated tool that can really properly analyze index usage and make really good suggestions for changes. You...
September 29, 2022 at 9:08 pm
SQL already captures the vast bulk of the stats you need, thus you don't generally have to set up separate runs, etc. to capture activity.
If you're willing to run the...
September 29, 2022 at 9:03 pm
DECLARE @EndDate date
DECLARE @StartDate date
SET @StartDate = '20220101' --<<-- change @Start and @End values to get any date range you want
--get end of current month
SET @EndDate =...
September 26, 2022 at 4:40 pm
Btw, you should always specify nullability (NULL / NOT NULL) when ADDing a column, otherwise it's extremely difficult to determine what you'll get there.
September 23, 2022 at 2:27 pm
To get the last datetime for a given set of datetimes, you'd typically use ROW_NUMBER(), like this:
select ...
From (
select *, row_numnber() over(partition by...
September 22, 2022 at 3:56 pm
Hello everyone!
I am in dire need of some assistance or direction. I am by no means a expert at any of this stuff. Unfortunately for me the...
September 20, 2022 at 3:34 pm
Hello everyone!
I am in dire need of some assistance or direction. I am by no means a expert at any of this stuff. Unfortunately for me the company...
September 20, 2022 at 3:14 pm
SELECT CONVERT (decimal(9, 2) , CAST('$15,000.50' AS money))
September 20, 2022 at 3:10 pm
No need to specify the last day / number of days in the month, that can easily be calculated:
(CASE WHEN MONTH = @month AND DAY = @day...
September 20, 2022 at 2:26 pm
I agree. In fact, any book on T-SQL by Ben-Gan will be worth studying.
September 15, 2022 at 2:52 pm
You might find it easier to reason about with EXCEPT and INTERCECT.
SELECT DISTINCT KEY FROM myTable WHERE type = 'COLL' and subtype = 'MOD'
EXCEPT
SELECT DISTINCT KEY...
September 14, 2022 at 9:26 pm
Yes. If you only want a key that has both conditions, change the MAX:
MAX(CASE WHEN type = 'QUAT' AND subtype = 'BALANCE' THEN 1 ELSE 0 END) = 1
Note that...
September 14, 2022 at 8:46 pm
SELECT key
FROM dbo.your_table_name_here
GROUP BY key
HAVING MAX(CASE WHEN type = 'COLL' AND subtype = 'MOD' THEN 1 ELSE 0 END) = 1 AND
MAX(CASE WHEN...
September 14, 2022 at 7:46 pm
I don't think so. PIVOT works on only one column at a time, IIRC. A cross-tab is almost certainly the best method here.
September 14, 2022 at 7:12 pm
Viewing 15 posts - 631 through 645 (of 7,614 total)