How would I do in a SELECT query to reverse this path :
z/y/x
for
x/y/z
where / is the delimiter
and where there can be many delimiters in a single line
ex: select (... z/y/x/w/v/u ...) reversed_path from ...
...
I have a small table of measurement units in Oracle (10.2.0.4). It's defined as
CREATE TABLE Units (
UNIT_ID number,
UNIT varchar2(12)
)
It's populated with a few records, and one of those records has a unit value of 'μL'. When I try to query for that record using this query...
select * from units where unit = 'μL'
.. I g...
Is there a way to know the order of an specific item in a query result with traversing the whole set?
I have a web application that show user comments in Ajaxified way, I would like to send the user a link to their comments like this:
http://my.web/post/12345#comment%5F45
and using the hash value "comment_45" load the comment page wit...
My MySQL table is simple. I have 3 fields:
an index
a url
a title
making up 20 records.
I'm trying to count the number of rows so that I can paginate with PHP. But count(*) is returning more than the number of rows that are there, 142 total. I get the same results counting the index.
What am I missing?
edit
Sorry for the previous...
I am converting all my MSSQL queries to mysql and my queries that has "with" in them are all failing
with t1 as
(
SELECT article.*, userinfo.*, category.* FROM question
INNER JOIN userinfo ON userinfo.user_userid=article.article_ownerid
INNER JOIN category ON article.article_categoryid=category.catid
WHERE article.ar...
I am working on the design of a database that will be used to store data that originates from a number of different sources. The instances I am storing are assigned unique IDs by the original sources. Each instance I store should contain information about the source it came from, along with the ID it was associated by this source.
As an...
I have heard that DateTime.Now is very expensive call (from here)
Is GETDATE() in SQL 2005/2008 expensive? Have I to cache it into a variable if my stored procedure uses it a number of times?
...
i have a table that has event name and event date.
if i want to get the last 10 events by date, can i do that by sql or do i need query the whole table and do the filtering in code.
...
I created few user defined types in DB as below
CREATE TYPE [dbo].[StringID] FROM [nvarchar](20) NOT NULL
and assigned to various tables. My tables in db are in various schemas (not only dbo)
But I realized I need bigger field, and I need to alter, e.g increase from nvarchar to nvarchar, but there is no ALTER TYPE statement
I need a...
I've seen people writing the following query
SELECT column_name(s)
FROM table_name1
LEFT JOIN table_name2
ON table_name1.column_name=table_name2.column_name
written like this
SELECT column_name(s)
FROM table_name1
LEFT JOIN table_name2
ON table_name2.column_name =table_name1.column_name
does it actually make any difference?
...
Hi. I'm developing a small application in WPF. I have a ListBox named NameListBox whose ItemsSource property is set to a DataView, and thus displays a list of customer names. The name is composed of 3 parts: FirstName, MiddleName, and LastName. I have used a converter to display the full name of customer in the list. Everything works fin...
According to MSDN BOL (Books Online) description on SOME | ANY (Transact-SQL),
SOME and ANY are equivalent.
It does make sense to use either SOME | ANY to make a query more readable.
But is that the only reason why there are 2 keywords in TSQL where they serve the exactly the same purpose?
Are there any historic reasons why they ...
I have scoured the web for a good example but I can't find anything.
I am trying to extend the mysqli class to make a helper class that will abstract away some of the complexities. One of the main things I want to accomplish is to make use of prepared statements.
I don't really know where to start, or how to handle input and output p...
I need the difference between two dates in Oracle in terms of days in which the dates were in the same column. That is, the difference between two dates after order by that column.
That is, after doing the order by, I need the difference between first two dates.
...
I have a project table with projectId as primary key:
**projectId**, projectName, dateCreated, etc.
Then, I have a userAccess table using a composite primary key:
**userId**, **projectId**
Only the users listed in the userAccess table for each project will be able to view the projects.
Now, I am trying to write a MySQL query whic...
Well, I was trying to select rows from one table if there are no rows in another table.
My original query was:
SELECT * FROM `jos_datsogallery` as a WHERE a.published = 1
and a.approved=1 NOT EXISTS (SELECT * FROM `jos_datsogallery_votes`
As v WHERE v.vip=62 AND v.vpic=a.id) ORDER BY a.imgdate DESC
but it keeps failing.
I made some...
I have used linq to sql to store files in a varbinary(max) field. Filestream is activated too, but when I try to store files with 400 or 500 MB I get this error:
Exception of type 'System.OutOfMemoryException' was thrown
My Code is:
Dim ByteArray() As Byte = File.ReadAllBytes(OpenFileDialog1.FileName)
Dim tb As New tb_1()
tb._id = ...
I have below trigger
ALTER TRIGGER [dbo].[DeleteUserData]
ON [dbo].[site_users]
AFTER DELETE
AS
BEGIN
SET NOCOUNT ON;
--delete user uploads
update my_gallery set deleted=1 where un=(select un from deleted) and subdomain=(select subdomain from deleted)
--delete user pms
delete from pms where toUn=(select un from deleted) and subdomai...
What datatype should i choose for storing an Ip Address in a SQL Server?
By selecting the right datatype would it be easy enough to filter by IP address then?
...
Let's assume three models, standard joins:
class Mailbox < ActiveRecord::Base
has_many :addresses
has_many :domains, :through => :addresses
end
class Address < ActiveRecord::Base
belongs_to :mailbox
belongs_to :domain
end
class Domain < ActiveRecord::Base
has_many :addresses
has_many :mailboxes, :through => :addresses
end
...