Click here to Skip to main content
15,900,258 members
Home / Discussions / Database
   

Database

 
GeneralRe: Asking for Help Pin
Vimalsoft(Pty) Ltd25-Mar-08 10:39
professionalVimalsoft(Pty) Ltd25-Mar-08 10:39 
QuestionGet Data Type of field/column? Pin
myNameIsRon24-Mar-08 16:55
myNameIsRon24-Mar-08 16:55 
AnswerRe: Get Data Type of field/column? Pin
John_Adams24-Mar-08 20:38
John_Adams24-Mar-08 20:38 
GeneralRe: Get Data Type of field/column? Pin
myNameIsRon25-Mar-08 9:18
myNameIsRon25-Mar-08 9:18 
Questionhow to add 7 days to my date filter Pin
hassanasp24-Mar-08 9:35
hassanasp24-Mar-08 9:35 
AnswerRe: how to add 7 days to my date filter Pin
Pete O'Hanlon24-Mar-08 10:42
mvePete O'Hanlon24-Mar-08 10:42 
AnswerRe: how to add 7 days to my date filter Pin
Sankar Komma 27-Mar-08 8:19
Sankar Komma 27-Mar-08 8:19 
GeneralComplicated query issue: need to specify strict return Pin
Vodstok24-Mar-08 8:49
Vodstok24-Mar-08 8:49 
I have a table i am querying, and a prety odd set i need to return.

the columns i am interested in are the following types:

int, nvarchar, datetime,datetime.

the int has a pretty normal progression, 1,2,3,4,5. the nvarchar contains only 2 possible values, we'll say red and blue. now, the data lines up something like this:

1 blue
2 blue
1 red
3 blue
2 red
3 red

ie, no particular order, but every number listed in the int coulmn has a red and a blue row, so a normal query would return

1 blue
2 blue
3 blue
1 red
2 red
3 red

if ordering by the colors

now, the two date times are a strat date and end date, and they line up weird. the blue and red of each int do not have the same range, but are considered related. however, all of the dates for a color tie together, so if the enddate for 1 blue is 4/25/2008, then the startdate for 2 blue is 4/26/2008. same goes for red, except what i end up with is something like this

1 blue 2/23/2008 3/12/2008
1 red 2/25/2008 3/20/2008

what i need to do is write a query that returns only 2 values, where they are both less than todays date, one is blue and one is red, and they both have the same int value.

now, the query i am using looks like this:
select top 2 * <br />
from [table] where enddate < cast('4/15/2008 12:59:59.999' as datetime)<br />
order by enddate desc


this particular one is right on the cusp of one of the transition dates, and the result i am getting is:

1 red
2 blue

when i need
1 red
1 blue

or

2 red
2 blue.


the int must always be the same and the nvarchar must always be different. is there a way to force this in a query?

what i end up needing is a query that returns

______________________
Mr Griffin, eleventy billion is not a number...WTF | :WTF:

GeneralRe: Complicated query issue: need to specify strict return Pin
Pete O'Hanlon24-Mar-08 10:45
mvePete O'Hanlon24-Mar-08 10:45 
GeneralRe: Complicated query issue: need to specify strict return Pin
A Wong25-Mar-08 5:11
A Wong25-Mar-08 5:11 
GeneralRe: Complicated query issue: need to specify strict return Pin
Vodstok25-Mar-08 6:01
Vodstok25-Mar-08 6:01 
QuestionVBA Access 2003 Error 2749 Pin
cyberE-gor24-Mar-08 6:40
cyberE-gor24-Mar-08 6:40 
Generalnewbee ado.net Pin
Mogaambo24-Mar-08 4:08
Mogaambo24-Mar-08 4:08 
GeneralRe: newbee ado.net Pin
pmarfleet24-Mar-08 4:36
pmarfleet24-Mar-08 4:36 
GeneralHandling Uncommited transanction when system terminated abnormally ! ( Please reply, it`s urgent) [modified] Pin
Member 470820224-Mar-08 2:53
Member 470820224-Mar-08 2:53 
GeneralRe: Handling Uncommited transanction when system terminated abnormally ! ( Please reply, it`s urgent) Pin
Mark J. Miller24-Mar-08 6:58
Mark J. Miller24-Mar-08 6:58 
GeneralRe: Handling Uncommited transanction when system terminated abnormally ! ( Please reply, it`s urgent) Pin
Member 470820224-Mar-08 18:08
Member 470820224-Mar-08 18:08 
GeneralRe: Handling Uncommited transanction when system terminated abnormally ! ( Please reply, it`s urgent) Pin
Pete O'Hanlon24-Mar-08 11:18
mvePete O'Hanlon24-Mar-08 11:18 
GeneralRe: Handling Uncommited transanction when system terminated abnormally ! ( Please reply, it`s urgent) Pin
Member 470820224-Mar-08 18:01
Member 470820224-Mar-08 18:01 
GeneralRe: Handling Uncommited transanction when system terminated abnormally ! ( Please reply, it`s urgent) Pin
Pete O'Hanlon24-Mar-08 23:09
mvePete O'Hanlon24-Mar-08 23:09 
QuestionHow can I ????????????? Pin
Mogaambo24-Mar-08 2:51
Mogaambo24-Mar-08 2:51 
AnswerRe: How can I ????????????? Pin
sarvesh.upadhyay24-Mar-08 3:15
professionalsarvesh.upadhyay24-Mar-08 3:15 
AnswerRe: How can I ????????????? Pin
hassanasp24-Mar-08 9:39
hassanasp24-Mar-08 9:39 
Generalquestion about retrieving Pin
johland24-Mar-08 2:21
johland24-Mar-08 2:21 
GeneralInsertion in table Pin
Syed Mujtaba Hassan23-Mar-08 22:37
Syed Mujtaba Hassan23-Mar-08 22:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.