?
Solved

very complicated query for detecting previously selected item

Posted on 2009-05-07
2
Medium Priority
?
142 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 37

Accepted Solution

by:
momi_sabag earned 2000 total points
ID: 24324803
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
ID: 31578956
thanks for your reply i have ressolved this problem
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

764 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