Showing posts with label wise. Show all posts
Showing posts with label wise. Show all posts

Monday, March 19, 2012

Displaying rows by month

Hi All,
I have a column in the table of type datetime.I need to get all the rows in the table but month wise.For Ex:

Jan 2003
(Rows whose date is in Jan 2003)
Feb 2003
(Rows whose date is in Feb2003)
.
.
.
Jan 2004
(Rows whose date is in Jan 2004)
Feb 2004
(Rows whose date is in Feb2004)
.
.
so on...

Can any body give my SQL query to get the desired results.
Thanks a lot,
Kumar.For January, 2003:

SELECT * FROM DateSample
WHERE MONTH(DateColumn) = 1 AND YEAR(DateColumn) = 2003

For February, 2003:
SELECT * FROM DateSample
WHERE MONTH(DateColumn) = 2 AND YEAR(DateColumn) = 2003

and so on...|||you need to use just simple order by this datetime field
if I understand your question

Sunday, February 19, 2012

display records row wise

hello

I am facing a problem in the crystal reports 8.5

In the database table one column is date ,
so here in my report i want to display the records in such a way that
the for every date there should be one colum like for 31 days there should the date in all 31 day

for example please refer the attachment

or see below the requirement is

in my example the records with the days like 21,22
which is diplaying in next to row of the 21 day but i want to show in the same row i.e side by side not in the next row

please any query please pass it so that i can explain you in more detail
urgentplz any one help me|||Maybe you can do this with a crosstab - no idea as I've never used them.
So, although there may be better ways the one I instantly thought of is:

Assuming you are grouping by month:
Create/initialise an array of 31 elements in the group header.
For each detail, add the value into the appropriate array element.
Display each element in its appropriate position in the footer, under its day number.

For completeness you could also suppress any day number heading if > number of days in the month.|||thanks for reply

But i had created with standard report.

but one more issue in this if i take in footer it will display only one record

how can i resolve this|||Don't know what you mean by "But i had created with standard report."

Anyway, if I understand correctly what you really want is for each detail line to be printed but for the 'RT' etc. values to be under the correct day number heading.
Maybe you could left-pad the 'RT' string with a number of spaces dependent on the day number, e.g.

ReplicateString (' ', ({day}-1) * n ) + {table.column}

where n makes the 'RT' text line up underneath the day number heading for any given day number assuming you have n characters between the start of each day number.
(Best to use Courier font or similar, rather than Ariel...)|||Dont use standard report. Use Cross tab option. See help file for more information

Display of Data category wise

Hi,

I have a requirement where I need to display the items category wise

I have 3 tables,

one stores category_id, parent_id and category_name

second table stored item_id,item_name and proce

3rd table stores category_id and item_id

I need to display the values like this

Category name, Item name

with first parent category ans ites items should be displayed and next sub category and its item

By category table with contain 2 levels of sub category

i.e Category1

Category11

Category111

any help with the query would be much appreciated,

I wrote the query something like this...

select c.category_name,parent_id,item_namefrom category c,items i,Category_item ciwhere

ci.item_id=i.item_idand c.category_id=ci.category_idorderby parent_id, category_name

But it will display all parent category items then the sub category items I want to display like thiscategory1 items1category11 item11category1 item12category11 item111category11 item112 category2 item2

Thanks

What you want is called "grouping".

Seehttp://www.google.com/search?q=gridview+grouping

Jos

|||

Please check the below mentioned URL:

http://vyaskn.tripod.com/hierarchies_in_sql_server_databases.htm