Hello everyone;
In the table MYSQL I have this sequence of rows:
CODE===========NAME
610=============ASS
610=============ASS
610=============ASS
610=============ASS
619=============ASS-9
619=============ASS-9
619=============ASS-9
I like to see:
ASS
and query that counts for all rows like ASS...
Can you help me ?
Regards
8 1829
Is the value ASS fix?
Try any of these... - select distinct name, count(name) from table where name = 'ASS'
-
/*will result to:
-
ASS, 4 */
-
-
select distinct name, count(name) from table
-
/*will result to:
-
ASS, 4
-
ASS-9, 3*/
-
-
select distinct name count(name) from table where name like 'ASS%'
-
/*will result to:
-
ASS, 4
-
ASS-9, 3*/
Many thanks Deric for your reply.
First I write you one example.
The real situation in the table mysql is:
9168383 510 >>>>> DTR SAR-ZO OR-UOS ORISTANO
9168383 519 >>>>> DTR SAR-ZO OR-UOS ORISTANO-9
9168383 110 >>>>> DTR SAR-ZO OR-PRG-PROGRAM.OPERATIVA
9168383 119 >>>>> DTR SAR-ZO OR-PRG-PROGRAM.OPERATIVA - 1
9168383 140 >>>>> DTR SAR-ZO OR-PRG-VERIFICHE
9168383 120 >>>>> DTR SAR-ZO OR-PRG-SICUREZZA E AMBIENTE
9168383 130 >>>>> DTR SAR-ZO OR-PRG-GESTIONE CONNESSIONI
9168383 100 >>>>> DTR SAR-ZO OR-PROGRAMMAZIONE E GESTIONE
This rows are divided by date ( 2008-04-01, 2008-04-02, ... ) and name of the person responsable ( Jim for 9168383 510, John for 9168383 519, ... ) of the unity.
I like to see:
9168383 510 >>>>> DTR SAR-ZO OR-UOS ORISTANO
9168383 110 >>>>> DTR SAR-ZO OR-PRG-PROGRAM.OPERATIVA
9168383 140 >>>>> DTR SAR-ZO OR-PRG-VERIFICHE
9168383 120 >>>>> DTR SAR-ZO OR-PRG-SICUREZZA E AMBIENTE
9168383 130 >>>>> DTR SAR-ZO OR-PRG-GESTIONE CONNESSIONI
9168383 100 >>>>> DTR SAR-ZO OR-PROGRAMMAZIONE E GESTIONE
And query that counts for all rows like DTR SAR-ZO OR and counts for all rows the same to:
9168383 510 >>>>> DTR SAR-ZO OR-UOS ORISTANO
9168383 110 >>>>> DTR SAR-ZO OR-PRG-PROGRAM.OPERATIVA
9168383 140 >>>>> DTR SAR-ZO OR-PRG-VERIFICHE
9168383 120 >>>>> DTR SAR-ZO OR-PRG-SICUREZZA E AMBIENTE
9168383 130 >>>>> DTR SAR-ZO OR-PRG-GESTIONE CONNESSIONI
9168383 100 >>>>> DTR SAR-ZO OR-PROGRAMMAZIONE E GESTIONE
You understand me ?
If you don't understand all this I can send you the original table mysql.
Thans for your attention.
Viki
Yeah, sorry, it is hard to understand.
You may post the table schema here.
How did you arrive with the rows that you want to see? I mean, what are the conditions/requirements to get them? Through date, person responsible, or what?
Please supply more input... don't hesitate to post a long message, if that will clearly explain what you're trying to say.
***************
To any moderator:
This is not an ASP problem, but a mySQL's. Please move this so that it will be better helped. Thanks.
So "DTR SAR-ZO OR" is fixed? No other values that will start differently?
My problem is, where did you get the code '9168383500"? In you table, there is no row with that code... Anyway, I think you can work it out for yourself now.
Try this simple approach: - SELECT '9168383500' AS CODE, 'DTR SAR-ZO OR' AS NAME, COUNT(*) AS NUMBER FROM tbl WHERE Name LIKE 'DTR SAR-ZO OR%'
-
-
UNION
-
-
SELECT DISTINCT Code, Name, COUNT(*) FROM tbl WHERE NAME LIKE 'DTR SAR-ZO OR%' GROUP BY Name
The above code will first get the count of all the rows with DTR SAR-ZO OR on their name, then combine it with the count of all the rows grouped according to Name.
thanks your query working !!!
That's good to know. Cheers!
To any moderator:
This is not an ASP problem, but a mySQL's. Please move this so that it will be better helped. Thanks.
Done (sorry only just noticed this post!).
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Ken1 |
last post by:
I am going to drop a primary key from one column and create a new
column to be used as primary key in an existing database.
The old column was a date column which someone earlier though was a
good...
|
by: Axier |
last post by:
Hi,
I wonder how this can happen.
A "not null" field is set to "" even if a sequence should set this
to next sequence number.
Ok, I know it is not set to null, it is set to '' which is proven...
|
by: Axier |
last post by:
Hi,
I wonder how this can happen.
A "not null" field is set to "" even if a sequence should set this
to next sequence number.
Ok, I know it is not set to null, it is set to '' which is proven...
|
by: Eric E |
last post by:
Hi,
I have a question about sequences. I need a field to have values
with no holes in the sequence. However, the values do not need to be in
order.
My users will draw a number or numbers from...
|
by: bboyle18 |
last post by:
Hi,
I am working with a table sorting script which can be found here
http://www.workingwith.me.uk/articles/scripting/standardista_table_sorting
This script works very nicely, but when there is a...
| |
by: Wilfried Mestdagh |
last post by:
Hi,
does foreach guarantees the sequence order starting from index 0 ?
--
rgds, Wilfried
http://www.mestdagh.biz
|
by: Szymon Dembek |
last post by:
Hi
Recently I did some DB2 and ODBC coding in Visual FoxPro. I bumped on a
problem I cannot resolve.
When I issue a delete statement that deletes no rows (no rows qualify
for the WHERE...
|
by: jsreddy |
last post by:
Hi All,
I am having 4 text boxes in a Gridview Template Column. The Tab Sequence is set to 0 - 4. the tab sequence works fine when i have only one Row. if i am adding one more row to grid then tab...
|
by: arachno |
last post by:
My Oracle sequences seem to be auto-incrementing themselves "over time".
My row ID's are sequenced like this:
1, 4, 5, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 41, etc
I'm using...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |