473,396 Members | 2,076 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Using LIKE '%%' with dates

Hi there i have a problem with on mysql query ..
i want to extract all the data from mysql table within 2 months ..

Expand|Select|Wrap|Line Numbers
  1. SELECT 
  2.   data_curenta,cod_produs,denumire,cantitate,pret,round((cantitate*pret),2) as 'Total',firma 
  3. FROM procesare 
  4. WHERE 
  5.   tip_actiune='intrare' 
  6. AND
  7.   data_curenta >= '2007-04-03' 
  8. and 
  9.   data_curenta <= '2007-05-05'  
  10. ORDER by cod_produs asc;
  11.  
i want to do something like that only with months :

data_curenta like '%2007-04%' and data_curenta like '%2007-06%'


i don't know how to do it .Pls help
May 13 '07 #1
3 1398
try
where data_curenta >= '2007-04-01' and data_curenta <= '2007-06-31'
:P
May 14 '07 #2
pradeep kaltari
102 Expert 100+
Hi there i have a problem with on mysql query ..
i want to extract all the data from mysql table within 2 months ..

SELECT data_curenta,cod_produs,denumire,cantitate,pret,ro und((cantitate*pret),2) as 'Total',firma FROM procesare WHERE tip_actiune='intrare' AND
data_curenta >= '2007-04-03' and data_curenta <= '2007-05-05' ORDER by cod_produs asc;"

i want to do something like that only with months :

data_curenta like '%2007-04%' and data_curenta like '%2007-06%'


i don't know how to do it .Pls help
Hi,
Try something like this:
Expand|Select|Wrap|Line Numbers
  1. SELECT * 
  2. FROM procesare 
  3. WHERE tip_actiune='intrare' AND
  4. data_curenta >= ( SELECT MIN(data_curenta) FROM procesare WHERE data_curenta LIKE '2007-04%') AND data_curenta < ( SELECT MIN(data_cureta) FROM procesare WHERE data_curenta LIKE '2007-06%' ) ORDER by cod_produs asc
  5.  
I hope this solves your problem.

Regards,
Pradeep
May 14 '07 #3
tnx .. it work . tnx a lot
May 14 '07 #4

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

Similar topics

4
by: Japhy | last post by:
Hello, I'm am pulling data from a mysql db and want to use the data to populate a <ul. Here are relavent parts of my code : $wohdate = mysql_result($wohRS,$wohndx,woh_date); $woh_display...
6
by: Bill R via AccessMonster.com | last post by:
I have a query: SELECT tblCalendar.CalendarDay AS LastSunday FROM tblCalendar WHERE (((tblCalendar.CalendarDay)>=(Now()-7) And (tblCalendar.CalendarDay)...
3
by: StBond | last post by:
Hi everyone, I am new to Access and Visual Basic so things my be getting across a bit cloudy. I only started using VB for one week. I am having a little problem with the database that I am...
5
by: DW | last post by:
I have a query in Access 2003 that has the following criteria SELECT tblOrder.SessionDate, tblMenus.Item_Name, tblOrder.Type, Format$(tblorder!SessionDate,"Short Time") AS SessionTime,...
13
by: Jim Armstrong | last post by:
Hi all - This problem has been driving me crazy, and I'm hoping the answer is something stupid I am neglecting to see.... The procedure posted below is part of an Access/SQL database I have...
8
by: Remington | last post by:
I am using windows 2000pro with access 2000. I am trying to make a database for our HR department, that would allow our HR Director to type in an employee's ID number into a form and then select...
5
by: veaux | last post by:
I'm thinking this is easy but can't get it. I have a table with following: Table1 Date 1/1/2007 Table2 Type 0107 (This is MMYY of above) So I'm having trouble using a query to turn the...
23
by: Steven TK | last post by:
Hi everyone, I wonder who can help me on the filter the Start Date and End Date. I still cannot manage to filter it. Eg. When the user click the StartDate(comboBox as 16/7/07), the Start...
4
by: TimK65 | last post by:
Hello, I am doing something a little weird (I'm withholding the details only so I don't bore anyone, although if I can't find a way to do this with DATEADD, I will probably have to explain more...
5
by: Dave | last post by:
Hello, I have a possible problem exporting a text field that happens to contain dates (but is not a date field) when using TransferText in MS Access 2000. I am exporting a query to a text...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.