Viewing 15 posts - 496 through 510 (of 898 total)
vijayarani87.s (7/6/2012)
July 6, 2012 at 12:42 am
Execute the below mentioned query
I had created a SELECT query from your UPDATE query
This results should give you an idea of what is happening
SELECTLEAN.METRICSID, MCD.PERFORMANCE, MEAS.*
FROM schemamanlog.trnleanmetricsperformance "MEAS"
INNER JOIN @METRICCOLORDETAILS...
July 6, 2012 at 12:17 am
Ok tanks for your reply but my colleague don't like the test if on stored procedure they prefere AND / OR 🙂
Any specific reason for this preference?
Also check the...
July 4, 2012 at 8:28 am
You can use the INTERSECT and EXCEPT operators
SELECTAN.artist_name, G.Genre_name
FROM#Artist AS A
INNER JOIN#artist_name AS AN ON A.art_id = AN.art_id
INNER JOIN(
SELECTA.mid
FROM#Artist AS A
WHEREA.art_id IN ( 'art1' )
INTERSECT
SELECTA.mid
FROM#Artist AS A
WHEREA.art_id IN ( 'art3'...
July 4, 2012 at 8:21 am
The sample data provided is not that extensive
Consider the below scenario
DECLARE @tbl_Student TABLE
(
StudentID INT,
FavoriteSubject VARCHAR(50)
)
INSERT @tbl_Student( StudentID, FavoriteSubject )
SELECT 1, 'Subject1' UNION ALL
SELECT 1, 'Subject2' UNION ALL
SELECT 2, 'Subject3' UNION...
July 4, 2012 at 6:35 am
You will probably need a CURSOR then to check all possible combinations and select the minimum one
I am unable think of a set-based solution right away, will let you know...
July 4, 2012 at 1:55 am
What is the maximum number of subjects that will be passed in the 'INPUT_SET_AS_LIST_OF_VALUES'
Will it be always 2 or can it be more than 2 ?
July 4, 2012 at 12:44 am
You will probably need an IF..ELSE block to achieve this
IF EXISTS(
SELECTStudentId
FROMStudentTopTwoChoices
WHEREFavoriteSubject IN ('INPUT_SET_AS_LIST_OF_VALUES')
GROUP BY StudentId
HAVING COUNT(*) > 1
)
BEGIN
SELECT*
FROMStudents
WHEREStudentID IN (
SELECTStudentId
FROMStudentTopTwoChoices
WHEREFavoriteSubject IN ('INPUT_SET_AS_LIST_OF_VALUES')
GROUP BY StudentId...
July 3, 2012 at 9:15 am
Good work with the test data
I hope the below query helps
DECLARE @Checkin date = '20120703'
DECLARE @Checkout date = '20120705'
DECLARE @diff tinyint
SELECT @diff = DATEDIFF(DAY,@Checkin,@Checkout)--+ 1
SELECT @diff As datedifference
; WITH cte_Rooms...
July 3, 2012 at 8:45 am
dilipd006 (7/3/2012)
HotelID RoomID AgencyID ...
July 3, 2012 at 7:29 am
The explanation given is not very clear
If you can explain more about your problem, we can even suggest you better solutions
July 3, 2012 at 5:20 am
Scorpion_66 (6/29/2012)
June 29, 2012 at 7:42 am
Welcome to SQL Server Central
Please check the link in my signature on how post your questions for faster and better replies
Since this is your first post, I have done some...
June 29, 2012 at 6:49 am
eagb (6/28/2012)
June 29, 2012 at 6:26 am
Edit: Removed the solution as it was incorrect for some cases on a larger data set
June 27, 2012 at 6:31 am
Viewing 15 posts - 496 through 510 (of 898 total)