want to get only one row(first one) when multiple rows are present in a table.....
-
I want to get only one row(first one) when multiple rows are present in a table..... e.g Prof ID -- Item -- Date 1 -- Mango -- 1-1-2005 1 -- Orange -- 2-1-2005 1 -- Apple -- 3-1-2005 2 -- Orange -- 2-1-2005 2 -- Apple -- 3-1-2005 I want this result: Prof ID -- Item -- Date 1 -- Mango -- 1-1-2005 2 -- Orange -- 2-1-2005
Do good and have good.
-
I want to get only one row(first one) when multiple rows are present in a table..... e.g Prof ID -- Item -- Date 1 -- Mango -- 1-1-2005 1 -- Orange -- 2-1-2005 1 -- Apple -- 3-1-2005 2 -- Orange -- 2-1-2005 2 -- Apple -- 3-1-2005 I want this result: Prof ID -- Item -- Date 1 -- Mango -- 1-1-2005 2 -- Orange -- 2-1-2005
Do good and have good.
That depends on your idea of what is first. Strictly speaking the rows in a database have no order although the underlying database software will put the data in a certain order it should always be thought of as unordered because the software may change and the previously implied order with it. So, given that a database is an unordered set of data, how do you define first? What do you want to put in the ORDER BY clause? Then we can figure out how to get the first of each series.
Upcoming Scottish Developers events: * We are starting a series of events in Glasgow in 2007. Are you interested in a particular subject, or as a speaker? * Developer Day Scotland: are you interested in speaking or attending? My: Website | Blog | Photos
-
That depends on your idea of what is first. Strictly speaking the rows in a database have no order although the underlying database software will put the data in a certain order it should always be thought of as unordered because the software may change and the previously implied order with it. So, given that a database is an unordered set of data, how do you define first? What do you want to put in the ORDER BY clause? Then we can figure out how to get the first of each series.
Upcoming Scottish Developers events: * We are starting a series of events in Glasgow in 2007. Are you interested in a particular subject, or as a speaker? * Developer Day Scotland: are you interested in speaking or attending? My: Website | Blog | Photos
infact i want to get just one record against "Prof ID". Order is not necessary here.... Waiting for reply
Do good and have good.
-
infact i want to get just one record against "Prof ID". Order is not necessary here.... Waiting for reply
Do good and have good.
Use simplest way that is GROUP BY option
Regards R.Arockiapathinathan