Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to arrange the values in column heading based on column STT

Status
Not open for further replies.

btamsgn

Instructor
Jan 17, 2011
10
0
0
VN
Hi Everyone,
How to arrange the values in column heading based on column STT
The values of STT 1 on the top
then values of STT 2 etc.
Pls find the attachment for yr ref.
Look forwarding to reive your reply, thanks.
Thank you.
sort-sapxep_h2kaa8.png
 
 https://files.engineering.com/getfile.aspx?folder=5c9fa02b-3726-47ea-bb12-55cbaed11e0b&file=sapxep.accdb
It is hard (at least for me) to decipher what you actually need.

The best way to ask is to state:
* This is what I have now:
(show an example of what you have)
* And this is what I want to have:
(show an example of what you would like to have based on the above example)



---- Andy

"Hmm...they have the internet on computers now"--Homer Simpson
 
Hi Andrzejek,
Thanks for your reply.
If you open tableA : column STT from 1-70,
column colcot with the 12 values(Ngọ,Mùi,Thân,Dậu,Tuất,Hợi,Tý,Sửu,Dần,Mão,Thìn,Tị)
column rowHang Based on STT: from 1 to 12 should be row 1: rowHang
Thái Tuế , Thiếu Dương ,Tang Môn,Thiếu Âm,Quan Phù , Tử Phù ,Tuế Phá ,Long Đức ,Bạch Hổ , Phúc Đức,Điếu Khách, Trực Phù.

The attachment for yr ref.
sort-sapxep_u3cgph.png

I want Query1 should be arranged as the picture above. However the query1 output differ as belows:
sort-sapxep1_ynt3yv.png
 
Really convoluted requirement, but what I've got from it is this:

This is the data you have:
AAA1_y5nru0.png


And this is the first record you want to create:
AAA2_wpufzl.png


So you want to pick [red]these values[/red] from your original data and make it into one (first) record:
AAA3_sjkvnf.png


Is that what you want to do [ponder]

---- Andy

"Hmm...they have the internet on computers now"--Homer Simpson
 
This is the data you have: => This data, I have typed by manual.
I want the data output like as belows:
sort-sapxep_qxo5ij.png
 
I am sorry, I cannot help you because I don't understand your requirements
Maybe somebody else jumps in to take over...

---- Andy

"Hmm...they have the internet on computers now"--Homer Simpson
 
I've been following this thread, wondering how Andy was going to figure out your requirements. Gathering user requirements and writing logical specifications for programmers was something I did for over 30 years in the aircraft industry.

Neither Andy nor I can discover the logic behind the visual example you posted. If I believed that this is what you really needed, and I do, I would tell you that this was an illogical requirement that I could not help you with.

We need a clear, cogent and concise explanation of your requirements. You have failed on all three.

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
"The most incomprehensible thing about the universe is that it is comprehensible" A. Einstein

You Matter...
unless you multiply yourself by the speed of light squared, then...
You Energy!
 
Hi SkipVought,
After a few days, I added a column "Sxep" into TableA then results out is ordered.
However results of Query "Qxep" quite Ok. But It is missing compare with query 1
Can you check and reply with new query to outputs with all data instead of missing
Pls find the attachment for your ref.
Your file's link is:
 
Hi everyone,
after a few days with my best, I found a solution for the issue.
How to order the values by STT in column headings ?
Only you create relationship with a little tip.
sort-sapxep_wwqa01.png

Results is good for your best.
Thank you.
 
If the target is to have columns ordered by STT ('if' - as there are no gaps only in your initial table), then:

1. create support query, named 'q_Position':
Code:
SELECT A_1.Cdem, A_1.rowHang, A_1.colcot, A_1.STT, Count(A_2.colcot) AS PosID
FROM TableA AS A_1 INNER JOIN TableA AS A_2 ON A_1.colcot = A_2.colcot
WHERE (((A_2.STT)<=[A_1].[STT]))
GROUP BY A_1.Cdem, A_1.rowHang, A_1.colcot, A_1.STT;
and next final crosstab query:
Code:
TRANSFORM Min(q_Position.rowHang) AS MinOfrowHang
SELECT q_Position.PosID
FROM q_Position
GROUP BY q_Position.PosID
PIVOT q_Position.colcot;
The result:
snap_uwou96.png





combo
 
Actually, it is the same technique as given by dhookom in your earlier thread701-1821242, I noticed just now.

combo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top