View Full Version : Problem in Query


Bruno Trindade
03-24-2009, 01:07 AM
Hi,

I created one query, but when I change the data for one row, the others rows with same data that I change, change too.

For example, I have two columns Name and Mobile number.

Name Mobile
Bruno Trindade 123456789
Bruno Trindade 548645485

If I change Bruno Trindade in first row to another name, the name in second row change too.

Can you help me with this?

Regards.

DanWall
03-24-2009, 01:14 AM
Instead of referring to the NAME in the expression, refer to the Indexed ID of the person.

An indexed ID only allows unique values.

Bruno Trindade
03-25-2009, 02:54 AM
Instead of referring to the NAME in the expression, refer to the Indexed ID of the person.

An indexed ID only allows unique values.

But I need to permit more than one value.

The problem is

I've several table, I build one query using this SQL:

SELECT Utilizadores.Utilizador, Utilizadores.Local, Equipamentos.Marca, Equipamentos.Modelo, Equipamentos.IMEI, Cartoes.N_Cartao, Equipamentos.Data, Packs.Tarifario & '_' & Packs.Numero AS Tarifario_Final, EstDistCont.Distrito
FROM (Utilizadores LEFT JOIN EstDistCont ON Utilizadores.Local = EstDistCont.ID) LEFT JOIN ((Equipamentos LEFT JOIN Cartoes ON Equipamentos.ID = Cartoes.ID_Equipamento) LEFT JOIN Packs ON Cartoes.ID_Tarifario = Packs.ID) ON Utilizadores.ID = Equipamentos.ID_Utilizador;

After this I created one form based on this query and in the form I've two rows where Utilizador is Bruno Trindade, because I have two mobile numbers. If I change the first row, where appears Bruno Trindade, to another utilizador(user) for example John, the second row replace Bruno Trindade to John too, but I only want to change the first row.

DanWall
03-25-2009, 03:19 AM
You can still have multiple values in the NAME column, however you need to reference a UNIQUE identity for each row.

Right now, you are refering to the NAME.

You need to add another column, that has a unique ID, that isolates that row from all the others.