Senin, 30 Januari 2012

[MS_AccessPros] Re: query field alocation.

 

Marius,

Based on your example records, as I suggested, you can use a crosstab query with SQL like:

TRANSFORM First(ThisTable.Input) AS FirstOfInput
SELECT ThisTable.ID
FROM ThisTable
GROUP BY ThisTable.ID
PIVOT "Input" & [Nr Crt];

The results are (view fixed width):
ID Input1 Input2 Input3 Input4 Input5
== ====== ====== ====== ====== ======
xx 1000 2000 3000 4000 5000

If your table or field names and/or your data is different from what you provided, you will need to change the SQL.

Duane Hookom
MS Access MVP

--- In MS_Access_Professionals@yahoogroups.com, "marius" <marius@...> wrote:
>
> Hi Clive,
>
> Unfortunately, I need something else.
>
> I have this field:
>
> id nr crt input
> xx 1 1000
> xx 2 2000
> xx 3 3000
> xx 4 4000
> xx 5 5000
>
> and I need sometrhing like this:
>
> input1 input2 input3 input4 input5
> 1000 2000 3000 4000 5000
>
> amean, I need to make one row whith elements from the table one after another, in fuction of nr crt.
>
> This is a transformation of a table to a table with one row.
> I have to make many calculation with those numbers only in this way.
>
> Consideration, marius.
>
>
>
> --- In MS_Access_Professionals@yahoogroups.com, "Clive" <zctek@> wrote:
> >
> > Hi Marius,
> >
> > When you view this message, click on 'Show Message Info' at the top
> > right-hand side and select 'Use Fixed Width Font. It will show the
> > message as formatted.
> >
> > You can show your table contents something like this,
> > ID NR_CRT Input
> > 1 abc 1000
> > 2 def 2000
> > 3 ghi 3000
> > 4 jkl 4000
> > 5 mno 5000
> >
> > Is this what you want from the query? Please correct it if
> > necessary.
> > Required Query Output
> > ID Result
> > 1 abc1000
> > 2 def2000
> > 3 ghi3000
> > 4 jkl4000
> > 5 mno5000
> >
> > Regards, Clive.
> >
> > --- In MS_Access_Professionals@yahoogroups.com, "marius" <marius@> wrote:
> > >
> > > I have this table, it has 5 records maximum.
> > > I have id, nr crt and input. Nr crt is from 1 to 5, and just for this exemple, the input is from 1000 to 5000.
> > > I need to make thru a query an artifice, so the result of that query to be some kind of concatenation between [nr crt] and [input], in this way: to[input1] i must have 1000, for input2] must have 2000...for [input5] i had to have 5000.
> > > A simple concatenation i manage to make, but in the resulting field, the result must be only that one from [input], amean: 1000, 2000...5000.
> > >
> > > Any ideea?
> > > I don't know how to put a picture in here. Can anyone tell me how to put a picture here? It should be more easy to explain.
> > >
> > > With consideration, MARIUS.
> > >
> >
>

__._,_.___
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar