By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,358 Members | 3,856 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,358 IT Pros & Developers. It's quick & easy.

Retrieving Data Problem in sql

P: 1
Hi,
I want to retrieve the status column of a table,by comparing two columns name STime and ETime.
The STime field value is 1130
The ETime field value is 1230
The Status field value is True

if I pass value @stime,@etime it should compare the STime and ETime and should retrieve the status.
if (etc.....@stime=1000 or @stime=1100 and @etime=1130)status=false
if(@stime=1230 and @etime=1300 or @etime=1330 .....etc)status=false
if(etc..... @stime=1100 or @stime=1130 and @etime betw 1200 and 1230 and....etc)status=true

I want the query to retrieve the status
Apr 16 '08 #1
Share this Question
Share on Google+
1 Reply


ck9663
Expert 2.5K+
P: 2,878
Hi,
I want to retrieve the status column of a table,by comparing two columns name STime and ETime.
The STime field value is 1130
The ETime field value is 1230
The Status field value is True

if I pass value @stime,@etime it should compare the STime and ETime and should retrieve the status.
if (etc.....@stime=1000 or @stime=1100 and @etime=1130)status=false
if(@stime=1230 and @etime=1300 or @etime=1330 .....etc)status=false
if(etc..... @stime=1100 or @stime=1130 and @etime betw 1200 and 1230 and....etc)status=true

I want the query to retrieve the status

You might want all this in a function. Read more about function here

CASE would also be helpful.

-- CK
Apr 16 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.