Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
sanjay2988
Starting Member
16 Posts |
Posted - 2009-01-06 : 05:17:55
|
| table is like this ---TicketID ActionCode strTransDescription1 item small pepsi1 item small coke1 DD Discount1 VX Void1 TX Tax paid2 DC Drawer closed2 TX Tax paid2 DD Discount and like this point of sale itemsQuestion is ---I want to search those TicketID where transactions are in a sequence given by operator. For eg :- item, VX, TX is searched. In ticketID 1 the sequence is followed (means first item come then VX and TX) so 1 is returned... but in ticketID 2 item is not present so it will not come.... if( TX comes before VX then it should not return 1 |
|
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2009-01-06 : 05:53:38
|
| You have a column which defines your sequence ? |
 |
|
|
sanjay2988
Starting Member
16 Posts |
Posted - 2009-01-06 : 06:01:04
|
| i have list of action code operator can give a sequence in listbox. we can put it in temp table as one column or can pass at runtime... |
 |
|
|
sanjay2988
Starting Member
16 Posts |
Posted - 2009-01-06 : 08:42:04
|
| Reply i am in great need |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-06 : 08:48:37
|
quote: Originally posted by sanjay2988 table is like this ---TicketID ActionCode strTransDescription1 item small pepsi1 item small coke1 DD Discount1 VX Void1 TX Tax paid2 DC Drawer closed2 TX Tax paid2 DD Discount and like this point of sale itemsQuestion is ---I want to search those TicketID where transactions are in a sequence given by operator. For eg :- item, VX, TX is searched. In ticketID 1 the sequence is followed (means first item come then VX and TX) so 1 is returned... but in ticketID 2 item is not present so it will not come.... if( TX comes before VX then it should not return 1
as sakets told you should have some column which designates the order. sql table does not have anything like first or last. you need to specify order based on a column value for you to determine sequence of arrival of values. May be an identity column or audit trail column like dateentered will be sufficient. |
 |
|
|
sanjay2988
Starting Member
16 Posts |
Posted - 2009-01-06 : 10:50:54
|
| i want to search occurance of values in a column. In above table i want those tickets having sequence of transactions given by user. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-06 : 10:55:37
|
quote: Originally posted by sanjay2988 i want to search occurance of values in a column. In above table i want those tickets having sequence of transactions given by user.
sequence of transaction given by user? how will they be inputting values as? also what column in table will determine the sequence in which you should search? |
 |
|
|
|
|
|