Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
jdeepkumar@gmail.com
Starting Member
2 Posts |
Posted - 2007-10-31 : 05:02:24
|
| Hi I have to find the stores between the time given value. for eg:I have a table called store_hours where store_id, day, open_time and close_time are the columns. a row containing sotre_id as 10004, day as Wednesday, open_time as 12:00 pm and close_time as 12:00 amhow can i find if store_id if the time given is 02:00 pm likeselect store_id, day, open_time, close_time from store_hour where open_time >= "02:00 pm" ans close_time <= "02:00 pm";when i tried this query its throwing some error.i need to kow how can i achieve this senario? help me pleasethanks in advance |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-10-31 : 05:07:29
|
what is the datatype for open_time and close_time ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
jdeepkumar@gmail.com
Starting Member
2 Posts |
Posted - 2007-10-31 : 05:48:36
|
| both are varchar |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-10-31 : 08:09:44
|
then you will have problem in comparing it. Convert to datetime before compare KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
IceDread
Yak Posting Veteran
66 Posts |
|
|
arorarahul.0688
Posting Yak Master
125 Posts |
Posted - 2007-10-31 : 09:11:51
|
| yes you can use the operators <= and >=create table rr(a varchar(50))insert into rr values(123)select * from rr where a<=130 and a>=120Rahul Arora MCA 07 BatchNCCE Israna, PanipatHRY, INDIA |
 |
|
|
elancaster
A very urgent SQL Yakette
1208 Posts |
Posted - 2007-10-31 : 09:55:33
|
| hmm... i don't think that was the point actuallyEm |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-11-01 : 03:09:20
|
quote: Originally posted by arorarahul.0688 yes you can use the operators <= and >=create table rr(a varchar(50))insert into rr values(123)select * from rr where a<=130 and a>=120Rahul Arora MCA 07 BatchNCCE Israna, PanipatHRY, INDIA
Read the question clearlyMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|