How can I do an SQL query that only shows me a record in a datagridview [closed]

2

I have my crews form where you are adding personnel, but when they are shown in the datagridview, I do not want them to show me all, but only one record per page.

Here is an example of this:

    
asked by Itzel 07.04.2017 в 17:30
source

2 answers

3

Then group it by the folio number as follows:

GROUP BY Folio, Nombre_de_la_cuadrilla

What this does, because it groups all the folios with the same name as the cuadrilla.

It's worth saying

If your query is the following:

SELECT FOLIO, NOMBRE_CUADRILLA
FROM MYTABLA;

I would show something like this:

____________________________________________________
|    FOLIO   |         NOMBRE_CUADRILLA            |
___________________________________________________
| MOC. 00001 | 3 albañiles + 3guardias de seguridad|
| MOC. 00001 | 3 albañiles + 3guardias de seguridad|
| MOC. 00001 | 3 albañiles + 3guardias de seguridad|
| MOC. 00002 | 2 mecanico + 2 ayudantes general    |
| MOC. 00002 | 2 mecanico + 2 ayudantes general    |
| MOC. 00002 | 2 mecanico + 2 ayudantes general    |
___________________________________________________

If you put GROUP BY in the following way

SELECT FOLIO, NOMBRE_CUADRILLA
FROM MYTABLA
GROUP BY FOLIO, NOMBRE_CUADRILLA;

The result would be:

____________________________________________________
|    FOLIO   |         NOMBRE_CUADRILLA            |
___________________________________________________
| MOC. 00001 | 3 albañiles + 3guardias de seguridad|
| MOC. 00002 | 2 mecanico + 2 ayudantes general    |
___________________________________________________

I hope you can solve your case. Success!

    
answered by 07.04.2017 в 17:36
0

to your query add the following

GROUP BY Folio

this should solve your problem

    
answered by 07.04.2017 в 17:34