473,661 Members | 2,457 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Select Column in Sequence

5 New Member
I have a situation where a person can have more then one item ordered. I need to layout the information as follows:

Person Items Ordered Item Description
----------------------------------------------------------------
1 1 of 2 Item1
1 2 of 2 Item2
2 1 of 1 Item1
3 1 of 3 Item3
3 2 of 3 Item1
3 3 of 3 Item2
.


The information is in the same table and the Items Ordered is in relationship to the Person and not the Item Description.

If anyone could help me it would be appreciated

ponderena
Jul 25 '07 #1
8 1935
ponderena
5 New Member
I have a situation where a person can have more then one item ordered. I need to layout the information as follows:

The first column, Person has:
1
1
2
3
3
3

The second column, Items Ordered has:

1 of 2
2 of 2
1 of 1
1 of 3
2 of 3
3 of 3

The third column, Item Description has:

Item1
Item2
Item1
Item3
Item1
Item2

.

I need to keep count of the the number of orders a person has and the tricky part for me is the ' num of <total number of orders>' column.

The information is in the same table and the Items Ordered is in relationship to the Person and not the Item Description.

If anyone could help me it would be appreciated

ponderena
Jul 25 '07 #2
debasisdas
8,127 Recognized Expert Expert
Can you please specify what exactly you want to achieve .

post with all your table structures and relations there off.
Jul 25 '07 #3
ponderena
5 New Member
Could you please look at the post above Select Sequence it may be clearer of what I am trying to achieve.

ponderena
Jul 25 '07 #4
ponderena
5 New Member
The name of the post is 'Select Column In Sequence'.

ponderena
Jul 25 '07 #5
debasisdas
8,127 Recognized Expert Expert
Kindly do not double post your questions .

Patiently wait for experts to answer your question.
Jul 25 '07 #6
debasisdas
8,127 Recognized Expert Expert
Post your questions clearly and specify what exactly you want to achieve .

post with all your table structures and relations there off.
Jul 25 '07 #7
ponderena
5 New Member
The first post was not readable. So I posted another. I know now that I should have replied to the first with a revised version of my question.

ponderena
Jul 25 '07 #8
debasisdas
8,127 Recognized Expert Expert
Both the threads are merged for convenience

MODERATOR.
Jul 25 '07 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

21
5245
by: John Fabiani | last post by:
Hi, I'm a newbie and I'm attempting to learn howto create a select statement. When I use >>> string1='18 Tadlock Place' >>> cursor.execute("SELECT * FROM mytest where address = %s",string1) All works as expected. But >>> numb=10 >>> cursor.execute("SELECT * FROM mytest where clientID = %d",numb) Traceback (innermost last): File "<stdin>", line 1, in ?
5
36765
by: Ken1 | last post by:
I am going to drop a primary key from one column and create a new column to be used as primary key in an existing database. The old column was a date column which someone earlier though was a good candidate for a primary key which we all know it's not. Now I want to add a new field, i.e. called ID, with a normal number sequence as primary key. I have dropped the primary key, created the new column, created the new sequence and created...
12
46633
by: Andrew Baker | last post by:
What is the best way to lock an individual row in the following scenerio: --TODO - LOCK THIS ROW -- Return the next id SELECT next_id INTO next_id_out FROM owner.my_id_table WHERE app_id = app_id_in;
7
2655
by: php newbie | last post by:
I am trying to copy data from one table to another, and in the process add a sequence number to copied rows. I have looked at the IDENTITY function when creating tables, and essentially this is the behavior I am trying to duplicate. However, my question is if I can do this with the SELECT INTO statement as well. I have tried a few variations and it does not seem to work: SELECT seq_number = identity(10),
6
8719
by: python1 | last post by:
I apologize if this is redundant. How would one fill an empty column with a sequence of numbers? The column exists in a table with aproximately 1000000 rows of data. I believe in oracle the following would work: update foo set bar = rownum; ....but 'rownum' does not seem to exist in mssql. The numbers do not need to be in order, but I would like to keep them somewhat small.
1
15420
by: php newbie | last post by:
I have the following query that has been working so far. I modified it slightly to work from another source table (new_products). Now, SQL Server complains that the identity is inherited already: "Cannot add identity column, using the SELECT INTO statement, to table 'dbo.my_products', which already has column 'id' that inherits the identity property." Any suggestions for a work aorund?
1
1772
by: Gaz | last post by:
I'm sure this is an obvious question but much of SQL is new to me. I have a stored procedure and I want to use the results of a select statement elsewhere in the stored prcedure. The select statement will return at most one record and only one column, here's an example : select top 1 Sequence from MyTable where ParentId=4 and Sequence > 200 order by sequence
3
583
by: Alex | last post by:
Hi, I need to form a query where i can add some columns based on the result. Table A ColA, ColB ---------- 1 A 2 B
6
2467
by: Bjørn T Johansen | last post by:
I need to maintain a manually counter for an id-field, but I can do this two ways. Either make a counter table (which means one select and one update) or just selecting the largest id from existing table and increment by one (just one select + one table lock). Which one is fastest? Regards, BTJ
3
2221
by: D. Dante Lorenso | last post by:
I just ran into a dump/restore problem with a bigserial column on a renamed table. BIGSERIAL columns when created will automagically create the sequence also. The sequence name is derived from the table name and column name. I had a table named 'audio_usage' and defined a column like this: ausage_id BIGSERIAL
0
8341
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
Oralloy
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...
0
8754
jinu1996
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...
1
8542
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,...
0
7362
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5650
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4177
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...
1
2760
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
2
1740
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.