How to get info. for the past 3 or 6 months? | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

How to get info. for the past 3 or 6 months?

Hi there~<br /><br />I need a help on SQL queries in order for me to show out the previous past 3 months or 6 months information.<br /><br />Eg: If i select past 3 months, the invoice no. issue out for jan, feb and march will show out. If i select past 6 months, the invoice no. issue out for oct, nov, dec, jan, feb and march will show out. Is there any idea i could do that?<br /><br /><br />Urgently need help on this. Thanks in advance~ [<img src=’/community/emoticons/emotion-2.gif’ alt=’:D‘ />]
See if this helps:http://www.sql-server-performance.com/fk_datetime.asp
Frank Kalis
Moderator
Microsoft SQL Server MVP
Webmaster:http://www.insidesql.de
<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by Taurusgal83</i><br /><br />Hi there~<br /><br />I need a help on SQL queries in order for me to show out the previous past 3 months or 6 months information.<br /><br />Eg: If i select past 3 months, the invoice no. issue out for jan, feb and march will show out. If i select past 6 months, the invoice no. issue out for oct, nov, dec, jan, feb and march will show out. Is there any idea i could do that?<br /><br /><br />Urgently need help on this. Thanks in advance~ [<img src=’/community/emoticons/emotion-2.gif’ alt=’:D‘ />]<br /><hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote"><br /><br /><br />If your table has date timestamp column, you can easily get this by comparing the dates. Can you post your table structure?<br /><br /><pre id="code"><font face="courier" size="2" id="code"><br />Thanks,<br /><br />Name<br />——— <br />Dilli Grg <br /><br />(1 row(s) affected)<br /></font id="code"></pre id="code">
<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by DilliGrg</i><br /><br /><blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by Taurusgal83</i><br /><br />Hi there~<br /><br />I need a help on SQL queries in order for me to show out the previous past 3 months or 6 months information.<br /><br />Eg: If i select past 3 months, the invoice no. issue out for jan, feb and march will show out. If i select past 6 months, the invoice no. issue out for oct, nov, dec, jan, feb and march will show out. Is there any idea i could do that?<br /><br /><br />Urgently need help on this. Thanks in advance~ [<img src=’/community/emoticons/emotion-2.gif’ alt=’:D‘ />]<br /><hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote"><br /><br /><br />If your table has date timestamp column, you can easily get this by comparing the dates. Can you post your table structure?<br /><br /><pre id="code"><font face="courier" size="2" id="code"><br />Thanks,<br /><br />Name<br />——— <br />Dilli Grg <br /><br />(1 row(s) affected)<br /></font id="code"></pre id="code"><br /><hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote"><br />Hm, I’m inclined to think that it would be almost impossible to select data from a certain time range without storing time information in any way in the table.<br /><br />scnr… [<img src=’/community/emoticons/emotion-5.gif’ alt=’;)‘ />]<br /><br />–<br />Frank Kalis<br />Moderator<br />Microsoft SQL Server MVP<br />Webmaster:<a target="_blank" href=http://www.insidesql.de>http://www.insidesql.de</a>
]]>