|
|
Maybe because of semicolon you have missed.
For your info : Oracle TO_DATE
modified 24-Apr-20 22:18pm.
|
|
|
|
|
i want to join two tables(Firms and People) to show them in datagridview with ascending order in my program side but the thing is that they dont have any common point.so can i join them ?
vemedya.com
|
|
|
|
|
Sure you can, for instance :
select firms.nmbr as nmbr, firms.name as name, "firm" as type from firms
UNION
select people.id as nmbr, people.surname as name, "people" as type from people;
The UNION keyword joins the two result sets.
Cheers
I don't like my signature at all
|
|
|
|
|
yeah it worked..thanks Estys..one more question it showed the datas as ordered already actually i wished that so it works always like that or i am lucky
vemedya.com
|
|
|
|
|
Without seeing your query, I think that's just blind chance .
Cheers
I don't like my signature at all
|
|
|
|
|
my query is here
select firma_adi[Kişi/Firma],telefon1[Telefon No],telefon2[Telefon No],Telefon3[Telefon No],Telefon4[Telefon No],Telefon5[Telefon No] from Firmalar
Union
select kisi[Kişi/Firma],numara1[Telefon No],numara2[Telefon No],numara3[Telefon No],Numara4[Telefon No],Numara5[Telefon No] from Rehber
vemedya.com
|
|
|
|
|
You can order the data with the ORDER BY clause.
If all select statements use the same fieldnames you can use "ORDER BY <fieldname>",
otherwise you can use the form "ORDER BY 2" where the "2" is the position of the field.
Cheers
I don't like my signature at all
|
|
|
|
|
yeah it works with order too..thanks for your time
vemedya.com
|
|
|
|
|
Where are Stored Procedure stores in MySQL or any other database e.g. SQL Server etc .....
Further explanation of my question,
Such that if i created a database then i know all my data is in this created database ..... but if i talk about creating/using stored procedures then were are they stored.
I.ve searched some example and tutorials for stored procedure ... but i didn't found aobut it.
THANKS
|
|
|
|
|
khurram_shahzad wrote: Such that if i created a database then i know all my data is in this created database ..... but if i talk about creating/using stored procedures then were are they stored
They are stored in hidden table of same database.
You could access it using following.
select * from sys.sql_modules where object_id=object_id('Name_of_your_sp')
|
|
|
|
|
Hi
I would like to know how to create a view in Access???
In SqlServer there is a folder "Views" where u can create views in a very simple way.
Searching with google i found that in access are used sql queries instead of views, but didn't understand well.
Thanks bye
"For as long as men massacre animals, they will kill each other. Indeed, he who sows the seed of murder and pain cannot reap joy and love." Pythagoras
modified on Thursday, December 23, 2010 8:19 AM
|
|
|
|
|
jadughar wrote: I would like to know how to create a view in Access???
For that there's word 'Queries' Access .
jadughar wrote: In SqlServer there is a folder "Views" where u can create views in a very simple way.
View is nothing but the result of query. In SQL you can see the result as Views, But it isn't a physical data. It's just returned result of query.
jadughar wrote: Searching with google i found that in access are used sql queries instead of views, but didn't understand well.
View in SQL = Queries in Access.
|
|
|
|
|
ok..Thanks for the answer!
"For as long as men massacre animals, they will kill each other. Indeed, he who sows the seed of murder and pain cannot reap joy and love." Pythagoras
|
|
|
|
|
I am working with "SQL Server 2000 SP3 2000.80.760.0".
How to write recursive query for next example ? (I use .net c# to query database, and my knowledge of SQL is limited ...)
All queries are done from the same table (lets call it "parts_table").
Let say I start with "part_ID" = 1001 --> query returns 120 "subpart_id" (1002, 1004, 2030 ...)
then I execute same query 120 times and get n subparts for each of 120 subpart_ID from first query and so on
until there are no subparts left. As you can see the number of queries can increase very fast ...
Table: "parts_table"
id part_id subpart_id
1 1001 1002
2 1001 1004
3 1002 2150
4 1002 3250
5 1004 1250
.
Part description for "part_id" is in separate table "part_info". I use join to get info for "part_id" ...
|
|
|
|
|
Why you need to run query 200 Times ?
There's way in SQL to achieve anything directly rather then looping it. it's not a good practice and having overhead to Query engine.
Either way you can IN in SQL Like,
SELECT * from table where subpart_id IN (SELECT subpart_id FROM parts_table where part_id='1001')
Your question is not quite clear on what you want to exactly achieve.
|
|
|
|
|
Hiren Solanki wrote: Your question is not quite clear on what you want to exactly achieve.
It is recursive. And stated explicitly as such and also implicitly defined as such in the post.
|
|
|
|
|
I still haven't finished thinking about this from when you asked it before in the C# forum. Did you try the TVPs? Oh, right 2000.
|
|
|
|
|
I am rather certain that your given table structure requires looping. You can use either actual loops or procs (recursive) for this but the result is the same.
Doing it in the database would probably be better than C# (per your other post.)
If you can modify the table then there are probably other solutions.
See the following link and drill down on the sublinks on it as there are other solutions.
http://www.sqlteam.com/article/more-trees-hierarchies-in-sql[^]
You might also try googling with the following: sql hierarchy query -cte
|
|
|
|
|
I'd like to create a SQL statement which would do such thing:
Having a table/query of these columns:
number of type integer
text of type text (string)
I'd like execute such a SQL Statement:
SELECT number,concatenate(text)
FROM table
GROUP BY number
Resulting rows should contain concatenation of every value in column "text" for each number value.
Is it possible at all?
modified on Thursday, December 23, 2010 5:55 AM
|
|
|
|
|
liquid_ wrote: Is it possible at all?
Yes, That is possible.
Suppose Consider AdventureWorks DB
First create UDF fn_Join as Below,
USE [AdventureWorks]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER function [dbo].[fn_Join](@managerID int)
returns varchar(max)
AS
BEGIN
DEclare @ret varchar(max)
SELECT @ret = SUBSTRING(
(SELECT ',' + s.Title
FROM HumanResources.Employee s
WHERE ManagerID = @managerID
FOR XML PATH('')),2,200000)
RETURN(@ret)
END
That will give you a concatenated string of all the Title by giving ManagerID as a INPUT.
Now write the query to fetch all the distinct ManagerID and it's corresponding concatenated Title
select distinct ManagerID,dbo.fn_Join(ManagerID)
from HumanResources.Employee
WHERE ManagerID is not null
That's will give you a desired result.
|
|
|
|
|
Thanks but I'm afraid this does not work with MS Access. There is no straight way to create function or procedure or I don't know about it.
|
|
|
|
|
You could've mentioned MS ACCESS at a database.
liquid_ wrote: There is no straight way to create function or procedure or I don't know about it.
I also don't know as I've not worked much on ACCESS.
Regards,
Hiren.
modified on Thursday, December 23, 2010 2:52 AM
|
|
|
|
|
With MS Access I had to use VB function which does similar thing. Anyway thanks for an idea.
|
|
|
|
|
Hey all,
I am trying to construct a basic search query and am having trouble with my wildcard searches.
I am using C# Visual Studio 2008 and the dataset query designer.
The part of the query I am struggling with is:
WHERE (Land_use_code LIKE '%' +@Landusecode1 + '%')
However, when I run the query, it doesn't perform as I would expect.
There are multiple table entries, with some as follows:
R1
R3
R30
If I enter R and run the query, it returns nothing. If I enter R1, it returns all that match R1.
If I enter R%, it will return R1 and R3, but not R30. If I enter R%%, I will get all records.
I am wondering of a way to enable me to enter R% and get all records returned.
Thanks,
Joe
|
|
|
|