473,233 Members | 3,513 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,233 software developers and data experts.

date query

Hi all,

I have a l list of persons and birthdays (stored as a date eg:
1980-07-11). I want to query the 4 first persons that will have their
birtday. Can this be done via query?

Thanks in advance
Stijn

Jul 17 '05 #1
4 2301
Yes.
If possible, it might be'd better if you remove
the dashs from the date, anyway:

Something like the following:

SELECT * FROM birthdays WHERE birthday < $today ORDER BY birthday DESC
LIMIT 4

Jul 17 '05 #2
Tarscher wrote:
Hi all,

I have a l list of persons and birthdays (stored as a date eg:
1980-07-11). I want to query the 4 first persons that will have their
birtday. Can this be done via query?

Thanks in advance
Stijn


Probably.

Unless you're using GDBM or similar you might be better asking the question
on a forum for your DBMS. You didn't say what that was so I can't point you
in the right direction.

C.
Jul 17 '05 #3
I want to receive the first 4 people that van their birthday after
today and still having problems. I tried to use
SELECT naam, birthdays FROM tblperson
WHERE birthdays <= $today
ORDER BY DAYOFYEAR(birthdays ) LIMIT 4

$today yyyy-mm-dd

I have some issues here
- When I encapsulate $today in '' I don't receive any results
- When applying the order by clause birthdays all the oldest persons
are returned
- When applying the order by clause DAYOFYEAR(birthdays) all the
persons in January are returned

When I query end of december I also want to get the people that have
their birthday in January. Will this work with birthdays <= $today?
I use MySQL

I hope someone can help me out

Jul 17 '05 #4
Tarscher spilled the following:
I want to receive the first 4 people that van their birthday after
today and still having problems. I tried to use
SELECT naam, birthdays FROM tblperson
WHERE birthdays <= $today
ORDER BY DAYOFYEAR(birthdays ) LIMIT 4

$today yyyy-mm-dd

I have some issues here
- When I encapsulate $today in '' I don't receive any results
- When applying the order by clause birthdays all the oldest persons
are returned
- When applying the order by clause DAYOFYEAR(birthdays) all the
persons in January are returned

When I query end of december I also want to get the people that have
their birthday in January. Will this work with birthdays <= $today?
I use MySQL


Getting there - but you still leave us to do some guessing.

Try:

SELECT * FROM tblperson
WHERE DAYOFYEAR(birthdays) >= DAYOFYEAR(CURDATE())

C.

Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Russell | last post by:
I'm having a fit with a query for a range of dates. The dates are being returned from a view. The table/field that they are being selected from stores them as varchar and that same field also...
2
by: BlackFireNova | last post by:
I have an Access 2003 mdb which contains software records. I need to sort on a particular type of software, and then identify and count how many copies there are per each group of that type...
10
by: Kenneth | last post by:
I have a Query that consist of a lot of different sales data, and one of the colums are different date. The date goes from 1jan2003 til 31jan2003. in this Query I only want the salesdata for...
7
by: Nicolae Fieraru | last post by:
Hi All, I have a table tblProducts where I have four fields:\ Index, ProductName, EnterDate (as Date/Time - Medium Date), PurchaseDate (Date/Time - Medium Date) The EnterDate is automatically...
4
by: Peter Bailey | last post by:
I have a vba string taht dynamically creates the query which has two dates in it that it grabs off an open form as a string from the textbox. What I generate in vba is: SELECT DOSMBK.Date,...
12
by: Steve Elliott | last post by:
I have a query set up to gather together data between two specified dates. Shown in the query column as: Between #24/09/2004# And #01/10/2004# Is it possible to enter several different date...
3
by: manning_news | last post by:
Using A2K. I've been asked to modify a report currently requiring only one date parameter to now accept a date range. The main report has 2 subreports and is not bound to a table or query. The...
11
by: Dixie | last post by:
How can I programatically, take some Date/Time fields present in a table in the current database and change their type to text? dixie
10
by: Daniel | last post by:
In Microsoft Access I can write a query that includes the criteria: Between Date()-7 And Date() to retrieve the records from a table that fall within the last week. I'm trying to write a...
2
by: sixdeuce62 | last post by:
Hello, I am trying to create a query that will prompt me to enter the parameter value if beginning date and ending date. I have created everything I need in the query, but I have to manually go...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.