I am trying to use auto-number function but it should depend on other fields. For example, I am creating vendor number (XXXXXXX-XX) based on the following:
First two digits: Country.
Digits 3 and 4: Province.
Digits 5, 6 and 7 : Unique number (Autogenerated).
Last two digits (after -): Number of branches.
Related
i have a problem where we need to generate Unique codes for few million rows in a table that has several other data cases.
For ex - table has data for case A, B, C - each having million rows.
Need to generate uniques only for data in case A.
Issue is that - we have a 12 digit unique number (all integers - those will not repeat within A, but can repeat across A & B & C... say like customerIDs ), but the space for storing unique code (which can be alphanumeric) is just 10 :) .
Tried to work out a solution where we can take ascii to reduce a length. For ex - if 65 appears in the 12 digit number, we will read it as "A"....& so on..this reduces 1 digit..but there is no guarantee that 65 will appear...
Any clues will be greatly appreciated.
I'm using Microsoft Access 2007 to query two separate SharePoint sources.
The first has most of the data I need. The unique ID number for each row in the first has a corresponding column in the second. The ID from the first can occur multiple times in the second. (It's a mapping between two different databases of defects.)first.
What I want to do is this: find all the ID's from table one that occur in the second, and list ID's from the second for each item that corresponds with the first. For starters, I want something a bit like this:
Table 1 ID Table 2 ID's
5 9, 13, 23
10 11, 15
20 8
But there's also more data from Table 1 I want to display for each item.
What I'm getting is this:
Table 1 ID Table 2 ID Table 1 Data
5 9 Row 5 Additional Data
5 13 Row 5 Additional Data
5 23 Row 5 Additional Data
10 11 Row 10 Additional Data
10 15 Row 10 Additional Data
20 8 Row 20 Additional Data
What I want is something like this:
Table 1 ID Table 2 ID's Table 1 Data
5 9, 13, 23 Row 5 Additional Data
10 11, 15 Row 10 Additional Data
20 8 Row 20 Additional Data
Or perhaps:
Table 1 ID Table 2 ID's
5 9, 13, 23
Row 5 Additional Data
10 11, 15
Row 10 Additional Data
20 8
Row 20 Additional Data
How can I create a report like that?
Comma-separated list from multiple records
Grouping of multiple data rows into a comma-separated list is not a built-in feature of Access. There are various ways to do this, but I most often see links to Allen Browne's tutorial.
Multi-line row details
The difference between your last two examples is just a matter of formatting a Form or Report in Design View. A Report (here capitalized) in Access is a specific type of object for generating custom, formatted views of your data, often for printing or read-only viewing. A Form is a dynamic, on-screen view of your data. I suspect that your use of "report" is of a more general sense.
First of all, there is no way to make multiple lines using the default Datasheet View of tables and queries. To get multiple lines per row of data, you need to create a Form or Report object in Access. In Design View, you can move the data controls around the detail area to produce multiple lines for each data row. I suggest searching for tutorials on the web for creating Access Forms and Reports.
See Guide to designing reports.
Let's say there is a table like the following:
id | number
----|----------
1 | 1
4 | 6
5 | 2
14 | 3
now I need all numbers that are not set between 1 and the highest number that is set. Here the highest number is 6, so I need all numbers that are not set between 1 and 6. Here it is: 4 and 5
But how can I achieve this with spring and hibernate jpa with a MySQL database?
The highest number is easy. Sort numbers DESC and then the first one. But then return all missing numbers that are not in the database? Is this possible?
One way: select each number that is smaller then the highest number and check if the returned object is null. So first check 5, then 4, then 3, ... But this is of course very slow on big databases.
So another idea was: get all numbers that are set and get the missing numbers on java side with the difference of two lists (one list with the numbers out of the database, the other list with the numbers from 1 to the highest number of the database). But on big databases it is also dumb to get everything. (Let's say, there are 1 million entries and only one number is missing.)
The third idea: something like select where number NULL would be perfect. But for this the database would have to be initialized with all possible numbers ever there. So that is also not possible.
Is there a possible way? Am I overseeing something?
In
learncpp I noticed that it says that 2 bits can store 4 different values and they give an example in the table. I am somewhat confused by what they mean. My original interpretation was that 2 bits can only store 2 values (ie. just 0 and 1 since the definition of a binary digit is 0 or 1). However after looking at the table, do they mean that two bits can store 4 different COMBINATIONS of values (ie. 00 01 10 11).
do they mean that two bits can store 4 different COMBINATIONS of values (ie. 00 01 10 11).
Yes. Each unique "combination" (actually they are permutations) of bits represents a different value.
This is no different to the system of counting you are used to: the decimal system, except instead of each digit having two possible states (0 and 1) they have ten possible states (0, 1, ..., 8, 9). In binary (base 2), two digits can represent four different values (2 ^ 2), and in decimal (base 10), two digits can represent 100 different values (10 ^ 2).
They mean exactly that: Two bits store the values 0, 1, 2, and 3, which have a binary encoding of 00, 01, 10, and 11, respectively.
To work out the number of permutations you can do base^length and 2^2 is 4. There are 4 permutations possible in 2 bits.
I would like help with sql query code to push the consequent data in a specific column down by a row.
For example in a random table like the following,
x column y column
6 6
9 4
89 30
34 15
the results should be "pushed" down a row, meaning
x column y column
6 null or 0 (preferably)
9 6
89 4
34 30
SQL tables have no inherent concept of ordering. Hence, the concept of "next row" does not make sense.
Your example has no column that specifies the order for the rows. There is no definition of next. So, what you want to do cannot be done.
I am not aware of a simple way to do this with the way you are showing the table being formatted. If your perhaps added two consecutively numbered integer fields that provide row number and row number + 1 values, you could join the table to itself and get that information.
After taking a backup of you table:
Make a PHP function that will:
- Load all values of Y into an array
- Set Y = 0 (MYSQL UPDATE)
- load the values back from PHP array to MYSQL