Hi experts,
I am working on SQL server 2005 reporting services and i am getting a
problem in writting a query.
Situation is given below.
There is one table in database Named Child
Now i have to find the All childrens whoes Age is 13 years Base on
Some given parameter.
If User select Augus 2007 then It has to calculate the Childs who born
in August 1994 And if he select September Then query
should show only those child Who born in September 1994 and so
on..... And use can select another year month also like
August 2009 ...
I am writting the following query
Select Child_Name, DOb from Child
where ((CONVERT(DateT ime, A.Date_Of_Birth , 103) >= @ Parameter1
And (CONVERT(DateTi me, A.Date_Of_Birth , 103) <= @Parameter2)
If i know already month and year then i can write easily parameter1
and parameter2 But since these are comming from user so i m not
finding how to handle this.
Now please suggest me what i have to write in Where statement I think
a lot but not getting any idea about it.
Any help wil be appriciated.
Regards
Dinesh 2 7263
If I understand correctly, you want to select on a specific month of
birth that is 13 years prior to a month provided as a starting point.
create table Born (Name varchar(20), dob datetime)
INSERT Born values('Nancy', '19940704')
INSERT Born values('Ralph', '19940804')
INSERT Born values('Edgar', '19940904')
declare @d datetime
set @d = '20070801'
SELECT @d, *
FROM Born
WHERE DATEDIFF(month, dob,@d) = (13 * 12)
DROP TABLE Born
Roy Harvey
Beacon Falls, CT
On Thu, 30 Aug 2007 03:18:34 -0700, Dinesh <di*******@gmai l.com>
wrote:
>Hi experts,
I am working on SQL server 2005 reporting services and i am getting a problem in writting a query.
Situation is given below.
There is one table in database Named Child
Now i have to find the All childrens whoes Age is 13 years Base on Some given parameter.
If User select Augus 2007 then It has to calculate the Childs who born in August 1994 And if he select September Then query
should show only those child Who born in September 1994 and so on..... And use can select another year month also like
August 2009 ...
I am writting the following query
Select Child_Name, DOb from Child where ((CONVERT(DateT ime, A.Date_Of_Birth , 103) >= @ Parameter1 And (CONVERT(DateTi me, A.Date_Of_Birth , 103) <= @Parameter2)
If i know already month and year then i can write easily parameter1 and parameter2 But since these are comming from user so i m not finding how to handle this.
Now please suggest me what i have to write in Where statement I think a lot but not getting any idea about it. Any help wil be appriciated.
Regards Dinesh
On Aug 30, 6:36 pm, Roy Harvey <roy_har...@sne t.netwrote:
If I understand correctly, you want to select on a specific month of
birth that is 13 years prior to a month provided as a starting point.
create table Born (Name varchar(20), dob datetime)
INSERT Born values('Nancy', '19940704')
INSERT Born values('Ralph', '19940804')
INSERT Born values('Edgar', '19940904')
declare @d datetime
set @d = '20070801'
SELECT @d, *
FROM Born
WHERE DATEDIFF(month, dob,@d) = (13 * 12)
DROP TABLE Born
Roy Harvey
Beacon Falls, CT
On Thu, 30 Aug 2007 03:18:34 -0700, Dinesh <dinesh...@gmai l.com>
wrote:
Hi experts,
I am working on SQL server 2005 reporting services and i am getting a
problem in writting a query.
Situation is given below.
There is one table in database Named Child
Now i have to find the All childrens whoes Age is 13 years Base on
Some given parameter.
If User select Augus 2007 then It has to calculate the Childs who born
in August 1994 And if he select September Then query
should show only those child Who born in September 1994 and so
on..... And use can select another year month also like
August 2009 ...
I am writting the following query
Select Child_Name, DOb from Child
where ((CONVERT(DateT ime, A.Date_Of_Birth , 103) >= @ Parameter1
And (CONVERT(DateTi me, A.Date_Of_Birth , 103) <= @Parameter2)
If i know already month and year then i can write easily parameter1
and parameter2 But since these are comming from user so i m not
finding how to handle this.
Now please suggest me what i have to write in Where statement I think
a lot but not getting any idea about it.
Any help wil be appriciated.
Regards
Dinesh- Hide quoted text -
- Show quoted text -
Thanks Roy Harvey
Yes for your reply. I got my solution with your help.
Regards
Dinesh This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Michelle |
last post by:
Hi all
I am new to sql code and am not even sure i am posting this in the right
place but would be grateful for any assistance.
I am trying to write a sql query as follows:
I want to select data based on a route(OUTBOUND_ROUTE),
date(DATE_CREATED) and originating country(CARD_COUNTRY_ID). I have
another field call TOTAL_QUOTATION and my aim is to have one record
|
by: eamon |
last post by:
Im making this stored procedure to return the age of the user to the web
control but the problem is that DATEPART(). I can only Specify one and i need
the age to to the exact format of mm dd yy but i cant get it into the Query
so it can execute. And when I use the yyyy to return the Age it returns the
age as between 1 - 11 months and between 1 - 364 days. So for example the
user was
borned 21.11.85. when executed it returns the user is 20...
|
by: paii |
last post by:
I have a table that stores job milestone dates. The 2 milestones I am
interested in are "Ship Date" TypeID 1 and "Revised Ship Date" TypeID 18.
All jobs have TypeID 1 only some jobs have TypeID 18. I need a query that
will return the c date for TypeID 18 if it exist else the date for TypeID 1,
for all jobs.
the table structure is the following
Job
TypeID
|
by: Neil Grantham |
last post by:
I am creating a database for Nursery children, and part of the
reporting requirement, is to show those on the waiting list.
Children will be elligible for entry by age, and so based on their
date of birth, I would like a report that has calculated which intake
semester the child falls under.
So, children born 1-Sep to 31-Dec are Autumn, 1-Jan to 31-Mar are
Spring, and 1-Apr to 31-Aug are Summer
Somewhere in my database I'd like to...
|
by: leavandor |
last post by:
I am trying to design a query that works with a relationship between a
Table and a Query. I am comparing a value in the table with a computed
value inside the query.
The reason for this is that the Query calculates a field to become
identical to the corresponding table field, for instance:
Table 1 contains field "ID", which is WV008A00
Table 2 contains field "ID In", which is WV001000
| |
by: sandraz444 |
last post by:
I have an expression in the query under my form to autofill the date
under a certain condition but it wont write to the underlying table??
The date shows in the form but not the table. Does anyone know a
solution for this?
Thanks!
|
by: Jo |
last post by:
Hi there,
I'm Jo and it's the first time I've posted here. I'm in process of creating
a database at work and have come a little unstuck.....I'm a bit of a novice
and wondered if anyone could help. I work in a library and send out dual
language books to babies of dual or other nationality.
The db is to be used for logging a range of book titles and numbers ordered
and books sent out to individuals. I am trying to work out a way of...
|
by: AR123 |
last post by:
The mandatory form field that is not working is the TYPE OF ILLUSTRATION.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Proforma</title>
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
|
by: murch.alexander |
last post by:
I made a simple public function to set and return a date value (see
below). I have a number of queries that call up the function to get
the "As Of Date," which is typically set to today's date. Occasionally
though, I need to change the "As Of Date" to some date in the past,
and then when I run the queries, they're based on that date in the
past. This generally works fine, but, sometimes, the date gets reset
to something WAY in the past...
|
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 usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |