TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Sai Reddy
NA
214
31.2k
Find an available Seats which are adjacent to each other?
Jul 3 2018 7:48 AM
I found the following question in one blog. i am unable to find the logic. Please help me here.
The question is: Find an available Seats(Status – ‘y’) which are adjacent to each other.
CREATE TABLE tbl_MoviePlex (Seatid INT, Status CHAR(1))
INSERT INTO tbl_MoviePlex VALUES
(1,'y')
,(2,'n')
,(3,'y')
,(4,'y')
,(5,'n')
,(6,'y')
SELECT
a.Seatid
,b.Seatid
FROM tbl_MoviePlex a
INNER JOIN tbl_MoviePlex b
on a.Seatid = b.Seatid + 1
and a.Status = b.Status
What is happenning at on a.Seatid = b.Seatid + 1 ?
Reply
Answers (
1
)
How to use SSAS Cubes in ASP.NET MVC Application ?
Find the count of Lowercase, Uppercase, Special Characters?