473,386 Members | 1,720 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,386 software developers and data experts.

how to get current month data from two tables

194 100+
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 4708
JKing
1,206 Expert 1GB
Are these tables related?
Oct 8 '10 #2
mfaisalwarraich
194 100+
no they are not related
Oct 11 '10 #3
JKing
1,206 Expert 1GB
You could use a UNION to join the records of two tables.

MySQl UNION
Oct 12 '10 #4
mfaisalwarraich
194 100+
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
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
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,...
5
by: RandyG | last post by:
how do you pull the current months data without having to manually input the date each time?
3
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...
5
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...
3
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; ...
1
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...
1
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. ...
6
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...

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.