Become a part of the TranceAddict community!Frequently Asked Questions - Please read this if you haven'tSearch the forums
TranceAddict Forums > Main Forums > Chill Out Room > anyone know SQL?
  Last Thread   Next Thread
Share
Author
Thread    Post A Reply
JohnSmith
Agent Smith



Registered: Apr 2002
Location: Kamloops
anyone know SQL?

Hello, this is my first post here, i hope that someone can help me out.

I have a pretty complex SQL query, which is supposed to return a count of how many items are within a given time period.

however, there is a little "twist" to this, the items can open and close. so they have to be open during the period in question.

which means, that there is one of 5 possible criteria that will satisfy this, either they:

open before, and close after the period
open before, and close within the period
open within, and close within the period
open within, and close after the period

so, this is the SQL that i was using:

SELECT COUNT(*) FROM TBL_BQDATA WHERE ((DATA_ADDEDDATETIME > 6/1/2002 AND Closed_DATE <= 6/30/2002) OR (DATA_ADDEDDATETIME <= 6/1/2002 AND Closed_DATE > 6/30/2002) OR (DATA_ADDEDDATETIME <= 6/30/2002 AND Closed_DATE > 6/30/2002 AND DATA_ADDEDDATETIME > 6/1/2002) OR (DATA_ADDEDDATETIME <= 6/1/2002 AND Closed_DATE <= 6/30/2002 AND Closed_DATE > 6/1/2002)) AND (DATA_ADDEDDATETIME <= Closed_DATE);

The logic seems to be solid, but, i get no rows back. I have verified that there is in fact data in the table. I tried running this in the query builder in MS-Access 2002, and i got no results back as well. I took a screen shot to be clear, it shows the table data, as well as the query, one version nicely formatted, and one of just raw characters.



why don't i get anything back?

Why won't this select Query return any rows?

Old Post Sep-16-2002 21:29  Canada
Click Here to See the Profile for JohnSmith Click here to Send JohnSmith a Private Message Add JohnSmith to your buddy list Report this Post Reply w/Quote Edit/Delete Message

TranceAddict Forums > Main Forums > Chill Out Room > anyone know SQL?
Post New Thread    Post A Reply

 
Last Thread   Next Thread
Click here to listen to the sample!Pause playbackUnknown remix of Wavy Gravy [2002] [0]

Click here to listen to the sample!Pause playbackUnkle - "In a state" (Sasha Remix) [2004]

Show Printable Version | Subscribe to this Thread
Forum Jump:

All times are GMT. The time now is 07:26.

Forum Rules:
You may not post new threads
You may not post replies
You may not edit your posts
HTML code is ON
vB code is ON
[IMG] code is ON
 
Search this Thread:

 
Contact Us - return to tranceaddict

Powered by: Trance Music & vBulletin Forums
Copyright ©2000-2025, Jelsoft Enterprises Ltd.
Privacy Statement / DMCA
Support TA!