473,545 Members | 1,884 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to get current month data from two tables

194 New Member
Hi everyone,

I need to get the records for the current month from two tables. I know how to do it with one table. im using the following query for it:
Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM mytable  WHERE YEAR(date_column) = YEAR(CURDATE()) AND MONTH(date_column) = MONTH(CURDATE())
  2.  
This is giving me records for the one table only. but how i can get records from two tables?

please tell me.

Thanking you.

Faisal
Oct 8 '10 #1
4 4723
JKing
1,206 Recognized Expert Top Contributor
Are these tables related?
Oct 8 '10 #2
mfaisalwarraich
194 New Member
no they are not related
Oct 11 '10 #3
JKing
1,206 Recognized Expert Top Contributor
You could use a UNION to join the records of two tables.

MySQl UNION
Oct 12 '10 #4
mfaisalwarraich
194 New Member
yeah UNION ALL worked for me :)
Oct 12 '10 #5

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

Similar topics

4
15805
by: Gary | last post by:
How do you get the current month - 1 month? (so not a particular day, but the whole month) Thanks, Gary
4
7126
by: stevebuy | last post by:
Hi, I hope I'm posting this in the right forum. I'm using a calendar control in a detailsview template (aspnet 2.0). Its bound to data but in the edit view it always displays the current month, not the month containing the date that the control is bound to. How do I get it to display the month associated with the underlying data (rather...
5
2939
by: RandyG | last post by:
how do you pull the current months data without having to manually input the date each time?
3
2734
by: JC21 | last post by:
Hello all, I have a question on MS calendar. On one of my forms in my DB I have the MS calendar. My question is how do I set the calendar so that the current month is always displayed. Currently when ever I open the form the month of December is the default month. I always have to go into the design and change it to the current month. Is there...
5
10397
by: soni2926 | last post by:
Hi, I have a web application, asp.net and c# done in 2.0, which is going to return rows from the db with dates or certain events. The db is going to have events dates for the entire year, but on the site we just want those events for the current month. Is there a way to check this, check as each date is returned if it falls under the...
3
4666
by: rockdc1981 | last post by:
i want my combo box to show the current month when i add new data...the combo query goes like this SELECT tblMonth.MonthNo, tblMonth.MonthDescription FROM tblMonth ORDER BY tblMonth.MonthNo; month no=month description 1 january......... and so on is this possible...or any suggestions..thanks
1
1898
jamesd0142
by: jamesd0142 | last post by:
New here, need to store the current month in a variable? How can this be done? -------------------------------------------------------------------- Or if anyone can... i want to get the current month and store in a varibale. So i want @Month = current month ???
1
2304
by: guyborn | last post by:
I have been trying to get data from the database from the of the previous month to the second last week of the current month.I only managed to get data from the previous month to today's date. your help will be highly appreciated Regards Guyborn
6
27134
by: abhishekbrave | last post by:
i have created following drop down box for displaying year... i want to populate the drop down box upto current year.. and need to write a java script for this .. any pointers in this regard will be very helpful <select name=year> <option value=2008>2008</option> <option value=2007>2007</option> <option value=2006>2006</option> </select>
0
7478
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7410
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7923
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7437
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7773
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5984
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5343
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3466
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1901
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.