473,847 Members | 1,771 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Urgent Help needed in Sybase query

51 New Member
Hi Experts,
I have a problem in writing a sybase query for the following scenario,

My table has the following data,

id name
1 aa
2 bb
1 bb
3 cc
2 aa

I want a query which will give me the following output...

id name
1 aa
2 bb
3 cc

I mean here that the id field should be unique and the name field can any one from its group. for eg.
for the id value 1 the name field can be either aa or bb....

Hope the problem is clear.

Thanks in advance,
Mar 7 '07 #1
1 1030
62 New Member
I dont familiar with sybase but this query is OK for SQL Server you can get idea from it

Expand|Select|Wrap|Line Numbers
  1.  Select * from tablename where id in (Select id from tablename group by id)
Mar 7 '07 #2

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

Similar topics

by: Ashish | last post by:
Hi, I am using PHP 4.2.3 and Sybase 12.0 I want to insert records in multiple tables in a database. I also want to use transactions so that I can rollback in case there was a problem. I tried the following code, but I can not figure out how to retrieve the "status" from the batch.
by: Stuart D. Gathman | last post by:
I am still wanting to produce Python standard format documentation for Python extensions I have written. I have looked at the docs that come with Python itself, but I am new to Latex, and don't know how to add the document classes and styles from texinput for a new project. Is there a small project with documentation in the Python standard that I can use as an example? -- Stuart D. Gathman <stuart@bmsi.com>
by: Larryboy | last post by:
We have a need to retrieve Sybase data within a MS SQL Server application. We are using SQL Server's linked database feature with the Sybase 12.0 OLE DB driver. It takes 5 minutes to run a query that takes 2 seconds from isql. Any suggestions? Thanks
by: sandip | last post by:
Hi all, I am facing a problem while migrating a Sybase SQL query to DB2 UDB. The query involves left outer joins. The Sybase query syntax is as follows : select * from A, B, C where A.id1 *= C.id1 and B.id2 *= C.id2
by: Metal2You | last post by:
I'm working on an ASP.NET 2.0 application in Visual Studio 2005 that accesses a Sybase database back end. We're using Sybase SQL Anywhere I have installed and registered the Sybase .NET 2.0 DataProvider (iAnywhere.Data.AsaClient.dll) into the GAC so it can be used in the ProviderName property of a SQLDataSource and loads properly at run time. The application I'm writing is a bit more complex than the example I'm about to...
by: phillip.s.powell | last post by:
UPDATE redesign.student SET student_work_area_other SELECT REPLACE('anywhere,(.*)', '$1', i.work_area) AS regexp_col FROM mycompany.interns i, redesign.student s WHERE i.unique_key = s.unique_key GROUP BY work_area Of course this does not work, but I have no idea what the MySQL equivalent will be to something like this. I basically want to take out PART of a column field value and update it
by: News East | last post by:
Currently I must manually complete the following commands to set a new value for the "open objects" and "open indexes". I need a way script this process in a batch file. COMMANDS RAN: This is nothing to script, these commands obtain the current values for open objects and open indexes. isql -Usa -Pmanager -SCOP1_DS execute sp_countmetadata "open objects"
by: abdulbasith | last post by:
hi i need to select a data from a sybase table into a sql server 2005 table.i dont know whts is the query to do it, let me show u my code.i get error when i do that query select * from openrowset('MSDASQL','dsn=bodaily;uid=sa;pwd=welcome;Initial Catalog=phoenix;', ' select rim from rm_acct') this rm_acct is a sybase table can anyone guide me on this. thanks
by: sri | last post by:
My environment is DB2v9.1, Windows/AIX and I am trying to compile the stored proc below and I am getting an error, "ERROR SQL0104N An unexpected token "WITH" was found following "User_ID = UsrID; ". Expected tokens may include: "SELECT". LINE NUMBER=11. SQLSTATE=42601" CREATE PROCEDURE TestProc(IN UsrID INT) LANGUAGE SQL SPECIFIC TestProc DYNAMIC RESULT SETS 1
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.