473,480 Members | 1,949 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

mysql getting the latest value

1 New Member
Hi,

I am having a particular problem.

+-------------------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------------------+--------------+------+-----+---------+----------------+
| library_id | int(11) | | PRI | NULL | auto_increment |
| group_id | int(11) | YES | | NULL | |
| library_page_name | varchar(100) | YES | | NULL | |
| library_default | int(1) | YES | | NULL | |
| library_title | varchar(255) | YES | | NULL | |
| library_synopsis | text | YES | | NULL | |
| library_body | text | YES | | NULL | |
| language_id | int(3) | YES | | NULL | |
| file_id | int(11) | YES | | NULL | |
| user_id | int(11) | YES | | NULL | |
| library_allow_comments | int(1) | YES | | NULL | |
| library_create_datetime | datetime | YES | | NULL | |
| org_id | int(11) | YES | | NULL | |
+-------------------------+--------------+------+-----+---------+----------------+

I have duplicate entries in the above table what I want to get is the latest record of the duplicate entries. I tried the below

select max(library_id) as library_id,library_page_name,library_title from am_library where org_id=104 and group_id=99 group by library_page_name order by library_create_datetime desc;

Which i get

+------------+-------------------+---------------------------+
| library_id | library_page_name | library_title |
+------------+-------------------+---------------------------+
| 120 | SudPages | sud 1 |
| 102 | SudPage | Sudhakar's Wiki1 |
| 87 | MailList | mailing list requirements |
| 75 | TWAd | test wiki -Adrian |
| 73 | TestWikiRob | tesr3 |
| 69 | TestWiki | This is a test wiki |
| 67 | MentorWiki | Group Wiki Page |
+------------+-------------------+---------------------------+

in realiity the library_id120 actually belongs to the library_title sud 13.

How can i get this to work correctly I use
Ver 14.7 Distrib 4.1.20, for redhat-linux-gnu (i386) using readline 4.3
Jan 2 '07 #1
0 1099

Sign in to post your reply or Sign up for a free account.

Similar topics

5
3361
by: apchar | last post by:
I am trying to use php as a kind of servlet to act as a middle man between a java applet and mysql. I know java has jdbc but it's flakey and painful. php access to mysql is much nicer. So I have:...
7
3165
by: Jim | last post by:
I'm using PHP & MySQL to create a simple guestbook. I've created my table and I'm able to load my information in as usual. I would like it to display the latest entry first though. I set an id...
0
6667
by: Donald Tyler | last post by:
Then the only way you can do it that I can think of is to write a PHP script to do basically what PHPMyAdmin is trying to do but without the LOCAL in there. However to do that you would need to...
0
4008
by: mikey | last post by:
Hi all, I'm having great problems trying to install the latest MySQl RPM package onto my Red Hat Linux OS. There is already MySQL v 3.0 pre-installed with the RH Linux distribution disk but I...
0
3918
by: Mike Chirico | last post by:
Interesting Things to Know about MySQL Mike Chirico (mchirico@users.sourceforge.net) Copyright (GPU Free Documentation License) 2004 Last Updated: Mon Jun 7 10:37:28 EDT 2004 The latest...
5
4283
by: MLH | last post by:
I'm supposed to set a password for the MySQL root user. The output of mysql_install_db instructed me to run the following commands... /usr/bin/mysqladmin -u root -h appserver password mynwewpasswd...
115
13955
by: TheAd | last post by:
At this moment I use MsAccess and i can build about every databound application i want. Who knows about a serious open source alternative? Because Windows will be a client platform for some time, i...
13
2285
by: Jim Hubbard | last post by:
I have a client that desires a new application for use at several stores in different cities. He wants "real time" access to all store data and the ability to continue to run locally even if the...
7
2483
by: Paul | last post by:
I recently installed php 4.4.4 using windows binaries on Windows XP Pro. I also installed MySQL 4.1. I usually use Pear DB but I tried MDB2 and it worked fine until a client uses a different...
1
4577
by: javediq143 | last post by:
Hi All, This is my first post in this forum. I'm developing a CMS for my latest website. This CMS is also in PhP & MySQL. I'm done with the ADD section where the Admin can INSERT new records in...
0
7037
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6904
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...
1
6730
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...
0
6873
tracyyun
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...
0
5321
agi2029
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,...
1
4767
isladogs
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...
0
4471
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...
0
2976
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
558
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.