create table with fields ID, reserved_by,res_date
res_date is datefield like 2010-03-09 00:00:00.000 from
2005 to 2006 any date assume
based on res_date need to slect table and display
based on month (full jan details in database irrespective
of date and year
Answers were Sorted based on User's Feedback
Answer / sandip
//Show records for a given month
SELECT * FROM table_name (NOLOCK)
WHERE SUBSTRING(res_date, 6, 2) = (numeric value for month.
eg 01 for Jan)
//Show all the records sorted by res_date based on month.
SELECT * FROM table_name (NOLOCK)
ORDER BY SUBSTRING(res_date, 6, 2) ASC
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / thangas sujith prabu.s
select * from tablename where res_date>'2010-01-01
00:00:00.000' and res_date<'2010-02-01 00:00:00.000'
| Is This Answer Correct ? | 2 Yes | 1 No |
Answer / anilkumar manthena
select * from <Table> where datepart(month,res_date)=1
It will return all the reservations made on Month "January".
Ex:
SELECT DATEPART(month, '2009-02-13 18:35:06.523')
retrieves the value 2.
| Is This Answer Correct ? | 1 Yes | 1 No |
What is replication and database mirroring?
if 3 duplicate records in table,i want to delete 2 alternating duplicate records by keeping 1 duplicate and 1 original as it is,how?
What is de-normalization in sql database administration? Give examples?
how to insert the values in 5 table at a time with triggers . if u have any solution then co-operate me ?
you are provided with the single table having say 4 col ie fname lname age city , now the all records with displying of only fname and lname is required but in this format say my name is abhay khanna it will come like this abhay-khanna rahul-roy gaurav-singh the above format is required
What is the importance of a recovery model?
What are different types of statements that are supported by sql?
What is difference between stored procedure & function?
3 Answers CarrizalSoft Technologies, Concept Infoway, TATA,
How to assign new column names in a view?
can a table be moved to different filegroup? : Sql server administration
Do you know how to make remote connection in database?
Can Having clause be used without Group by clause?
6 Answers CarrizalSoft Technologies, CSC, CTS,
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)