V
V
Victor Glembitsky2012-03-06 11:14:16
MySQL
Victor Glembitsky, 2012-03-06 11:14:16

Displaying MySQL database values

Good afternoon! We need the advice of the habra community on the implementation of the output of information from the database.

One of our clients developed a parts database. The DB is initially designed badly enough. The client provides a CSV, from which we form a data display from the database on the web.

The same spare part can be found in several stores, but the database does not contain additional fields, but is implemented as follows:

part_number shop_1
part_number shop_2
part_number shop_3

Moreover, part_number is always the same, and we want to draw the conclusion as follows:

part_number yes no no

( yes, no - in the columns of stores, respectively)

What is the most effective solution to this issue? Thank you!

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
DeusModus, 2012-03-06
@DeusModus

entityId_1 | entityId_2
this is not a poorly designed relationship, but quite a 'many-to-many' relationship.
Your question is very poorly worded.
Something like:

Hello, we have a function for working with unicode, and the data on the number of purchases is stored in redis. What is the best way to make a poll for a user?

S
Stdit, 2012-03-06
@Stdit

The base is designed normally , it would be much worse with a table of the form (detail, store1, store2, store3).
Try grouping like this:

select номер_детали, group_concat(номер_магазина) as мазагины from детали group by номер_детали

E
Eternalko, 2012-03-06
@Eternalko

Normal base :)
The rest has already been written to you by the mind :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question