Solved

very complicated query for detecting previously selected item

Posted on 2009-05-07
2
136 Views
Last Modified: 2012-05-06
hi
i have to prevent an item to reappear based on the preconditions.
when user create a schedule the gameid is going inside the DayCountGame table

INSERT DayCountGame Values(@sVideoItemID,1,@gameid,@SlotStartTime,@ShowId)

when user next create the schedule i want to block the game to reappear in the same show where showid is matched. @showid is a dynamic parameter

i have done the join but i am not sure how can i add the condition if @showid = GB.showid
then apply this condition AND GB.[GameID]  is null

LEFT JOIN DayCountGame GB
ON VI.[GameID] = GB.[GameID]

AND GB.[GameID]  is null



CREATE TABLE [dbo].[DayCountGame](

	[VideoItemID] [int] NOT NULL,

	[SelectCount] [smallint] NOT NULL,

	[GameID] [int] NULL,

	[sd] [datetime] NOT NULL,

	[ShowID] [int] NULL

) ON [PRIMARY]

Open in new window

table.GIF
0
Comment
Question by:mattibutt
2 Comments
 
LVL 37

Accepted Solution

by:
momi_sabag earned 500 total points
Comment Utility
maybe

LEFT JOIN DayCountGame GB
ON VI.[GameID] = GB.[GameID]
where (@showid = GB.showid and GB.[GameID]  is null)
or @showid <> GB.showid
0
 
LVL 11

Author Closing Comment

by:mattibutt
Comment Utility
thanks for your reply i have ressolved this problem
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

When writing XML code a very difficult part is when we like to remove all the elements or attributes from the XML that have no data. I would like to share a set of recursive MSSQL stored procedures that I have made to remove those elements from …
Introduction: When running hybrid database environments, you often need to query some data from a remote db of any type, while being connected to your MS SQL Server database. Problems start when you try to combine that with some "user input" pass…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now