Slecting Multiple Distinct Columns..

Mar 7, 2006

Hi all...
I have a table in which some columns has distinct values and some has
duplicates..i wan to select all the columns with distinct values....no
problem if rows has null value in it....i tried a lot wit distinct and
group by but nothing got worked out...
Waitin for your reply.....
Thanking you...

View 2 Replies


ADVERTISEMENT

Select DISTINCT On Multiple Columns Is Not Returning Distinct Rows?

Jul 6, 2007

Hi, I have the following script segment which is failing:

CREATE TABLE #LatLong (Latitude DECIMAL, Longitude DECIMAL, PRIMARY KEY (Latitude, Longitude))

INSERT INTO #LatLong SELECT DISTINCT Latitude, Longitude FROM RGCcache



When I run it I get the following error: "Violation of PRIMARY KEY constraint 'PK__#LatLong__________7CE3D9D4'. Cannot insert duplicate key in object 'dbo.#LatLong'."



Im not sure how this is failing as when I try creating another table with 2 decimal columns and repeated values, select distinct only returns distinct pairs of values.

The failure may be related to the fact that RGCcache has about 10 million rows, but I can't see why.

Any ideas?

View 2 Replies View Related

Compact / Distinct Multiple Columns

Jun 13, 2008

Hi,

I have a table with the following example data

idcol1col2col3
----------------------------
1abcnullnull
1abcnullnull
1null123null
4alphanullnull
4alphanullgamma
1abc987null


I would want to reduce that somehow to
idcol1col2col3
-----------------------------
1abc123null
1abc987null
4alphabetagamma

First thing in my mind was distinct over multiple columns, but I haven't found any resource mentioning that possibility.
I don't immediatly see a way without (complex) looping.
Can anybody put me on the right track?

btw, I know that Id is not an id.
It's a table var that holds an id of a table combined with fields of other tables.

View 20 Replies View Related

Count Multiple Distinct Columns

Jul 20, 2005

I want to build query to return how many rows are in this query:select distinct c1, c2 from t1But SQL won't accept this syntax:select count (distinct c1, c2) from t1Does someone know how to count multiple distinct columns? Thanks.--Disclaimer: This post is solely an individual opinion and does not speak onbehalf of any organization.

View 3 Replies View Related

Help With Getting Distinct Records From Multiple Columns In SQL Query

Nov 3, 2005

I'm exporting the following query to a datagrid, however in the result set, some values are duplicated (for various reasons... mostly old software and poor categorization)...On the records with identical values, I want to look at the account number and the DateOfService fields and search for joint distinct values and only display that...Current Example:  ACCT NUM   |  DATE OF SERVICE  |________________________________   43490          |     10/01/2006  08:15:23  |     35999          |     10/10/2005  12:00:00  |   35999          |     10/24/2005  12:45:30  |   35999          |     10/10/2005  12:00:00  |   35999          |     10/10/2005  12:00:00  |   23489          |     10/15/2006  15:13:23  |Desired Result:  ACCT NUM   |  DATE OF SERVICE  |________________________________   43490          |     10/01/2006  08:15:23  |     35999          |     10/10/2005  12:00:00  |   35999          |     10/24/2005  12:45:30  |   23489          |     10/15/2006  15:13:23  |Here is the query I'm working with... just can't figure out how to join or limit the results to ONLY unique matches in Acct Number AND DateOfService.  "SELECT     tblCH.ProcedureKey AS CPT, tblPC.Description, DATEDIFF(d, tblPat.BirthDate, " & _        " { fn NOW() }) / 365 AS Age,  tblPat.LastName, tblPat.FirstName, tblPat.BirthDate," & _        "  CAST(tblCH.AccountKey AS varchar) + '.' + CAST(tblCH.DependentKey AS varchar) AS Account, tblCH.DateOfService " & _        " FROM         dbo.Procedure_Code___Servcode_dat tblPC INNER JOIN " & _        " dbo.Charge_History___Prohist_dat tblCH ON tblPC.ProcedureKey = tblCH.ProcedureKey RIGHT OUTER JOIN " & _        " dbo.Patient_Info___Patfile_dat tblPat ON tblCH.AccountKey = (tblPat.AccountKey AND tblCH.DependentKey) = tblPat.DependentKey "Any suggestions from y'all SQL gurus?  I have to have this report ready for production by tomorrow morning and this is the last fix I need to make =Thank you =)

View 6 Replies View Related

Slecting A Table Using A Local Variable Name

Jul 23, 2005

I am new at sql so would appreciate some helpI have the name of a table in alocal variable is it possible to select thistableDECLARE @name sysnameSET @name = 'tblSniffedItems'PRINT @nameSELECT * FROM @nameI expected this wo work but I got the following error.@name is declare as far as I knowServer messageMust declare the variable '@name'.Thanks in advanceAndre

View 4 Replies View Related

Distinct At Two Columns

Mar 8, 2007

I have this stored procedure:
ALTER PROCEDURE usp_My_Procedure  ( @Country varchar(5) )  AS SELECT DISTINCT City, Short FROM Table1 WHERE Country = @Country
RETURN
I want to select just one of each 'city' and 'short' in the database....But this is not working correct......Whats wrong?
Lets say that I have a table that looks something like this
City               Short
New York       NY
Los Angeles   LA
Lake Alice      LA
Los Angeles   LosAng

View 1 Replies View Related

How To Get The Distinct Of All Columns

Feb 17, 2014

i have written a query to get the latest modified objects in Database and my problem is it is giving because of case condition.

how to get the distinct of all Columns .

Name
Raj
NULL
Raju
NULL
NULL
Ram

required output :

Name
Raj
Raju
Ram

here is my query

SELECT CASE WHEN type = 'TT' THEN name ELSE '' END AS TableType,
CASE WHEN type = 'P' THEN name ELSE '' END AS Procedures,
CASE WHEN type = 'FN' THEN name ELSE '' END AS Functions,
CASE WHEN type = 'U' THEN name ELSE '' END AS Tables,
CASE WHEN type = 'V' THEN name ELSE '' END AS Views,
CASE WHEN type = 'TR' THEN name ELSE '' END AS Triggers
FROM sys.objects
WHERE type IN ('TT','FN','U','V','P','TR')
AND DATEDIFF(D,modify_date,GETDATE())< 5

View 4 Replies View Related

Insert Distinct Columns?

Apr 17, 2007

I have two rows of data:
Customer as string, Date as int
 These values are predefined so I cannot use autoindex.  I have to make sure that when I insert a row of data that it does not exist already int the database.  there can be duplicate customers and duplicate dates but not duplicate customer/date combinations.  What would the sql query be?
if    (select count(1) from customers where customer = @customer and date = @date) =< 0  
    insert into table1(customer, date) values (@customer, @date)
end if

View 2 Replies View Related

How To Get Distinct Columns Using COALESCE

Aug 20, 2007

Hi guys, can you please help me to solve this problem.  I have to get distinct row from offering column of xyz table.
 I have to get offering1, offering2 from xyz table. But I am getting only offering1. I should not get duplicate rows from XYZ table.
 SELECT DISTINCT @Staging_Off= COALESCE(@Staging_Off + ',', '')+ Offering
FROM xyz
WHERE xyz.Offering NOT IN( SELECT DISTINCT Offering.Offering
FROM Offering Join xyzON Offering.Offering= xyz.Offering
AND Offering.SourceSystem= @SourceSystem
)

View 1 Replies View Related

Max With Distinct Two Columns And Corresponding Third Field

Apr 30, 2014

i need to write a query and can't get it to work no matter how it try. Here's what i need:

T1
-------
a1
a2
datetime
a4
a5
.....

i need distinct max between a1&a2 which i can get no problem but i cant get that unique datetime that correspond to a1&a2 in 1 query because this is will a subquery in a big query. Creating another temp table etc is not an option for me.for every specific a1 there is many entries of a2 + timedate etc.

Code:
T1
-----------------------------
a1 a2 timedate

1 1 2014-04-31 10:59:38.000 ......
1 2 2014-04-31 10:59:39.000 .......
1 3 2014-04-31 10:59:39.500 .......
2 1 timedate .......
2 2 timedate .......etc

select distinct t1.a1
,max (t1.a2)
from t1

View 5 Replies View Related

Distinct But Include All The Columns

Nov 1, 2013

I have this but how can I get all the columns of the row? I only want them distinct per these 2 cols.

SELECT DISTINCT OrdHst.ordernbr, OrdNbr.trans
FROM OrdHst JOIN OrdNbr
ON OrdHst.ordernbr = OrdNbr.ordernbr
ORDER BY 1,2

Could return:

12345 001
12345 AAA
12345 BBB
12345 CCC
12345 PWB

View 2 Replies View Related

DISTINCT Only Certain Columns In On Table And Pull Their IDs

Mar 9, 2007

Please help. (I am using ASP, VB, SQL)I have a table with Office address information and it's ID. There could be a lot of offices in one city. But I would like to display only unique cities with certain names they start with and their id's.

View 5 Replies View Related

SELECT DISTINCT - But Just One Of The Selected Columns

Sep 22, 2005

Hi,

I have a table with 3 columns - userID, score, dateCompleted

From this table I wish to select the highest score for each userID and the date for that score. If there is more than one row with the same userID and score (i.e. the user got the same score twice), I want to select the earliest date.

To clarify, there are multiple rows which have the same userID, and may have the same score too, but I want to pull out just 1 score for each userID.

I could do this quite easily if the DISTINCT operator worked on a per column basis, but it works on the entire row instead. Is there a way to SELECT DISTINCT column, but still output other columns in those rows?

I hope this is clear, but please let me know if I've confused you.

View 3 Replies View Related

Forcing Specific Distinct Columns....

Dec 6, 2006

Hi Guys,

I have a slight problem, a query that i have written produces data with 2 primary keys the same... however, DINSTINCT wont work in this case as the rows are still different...

Is their a way to force 1 column to always be unique?

Heres the query:


SELECT TOP 5 ORDER_ITEM.ItemID AS 'Item ID', ITEM.ItemName AS 'Item Name',
(SELECT SUM(OrdItem2.ItemQuantity) FROM ORDER_ITEM OrdItem2
WHERE OrdItem2.ItemID = ORDER_ITEM.ItemID
) AS Total_Purchased, SUM(ORDER_ITEM.ItemQuantity) AS 'Customer Purchased',
CUSTOMER.customerForename AS 'Customer Forename',
CUSTOMER.customerSurname AS 'Customer Surname'
FROM ITEM, ORDER_ITEM, ORDER_T, CUSTOMER
WHERE ITEM.ItemID = ORDER_ITEM.ItemID
AND ORDER_ITEM.OrderID = ORDER_0510096.OrderID
AND ORDER_T.CustomerID = CUSTOMER.CustomerID
GROUP BY ORDER_ITEM.ItemID, ITEM.ItemName,
CUSTOMER.customerForename, CUSTOMER.customerSurname
ORDER BY Total_Purchased DESC


The query is supposed to select the TOP 5 Products sold as well as selecting the customer that purchased the greatest amount of that item and the amount they purchased.

Currently, i will get 2 duplicate rows (except for customers name and the items the purchased. Like this:

ItemID
83630Mathew Smith
8 366Tony Wattage

Which is kinda annoying.... is there anyway i can prevent this?

And also apart from the Where Joins... is there a more efficient way of writing this?

thx for reading :-)

--Philkills

View 14 Replies View Related

T-SQL (SS2K8) :: Max With Distinct Two Columns And Corresponding Third Column

Apr 30, 2014

T1
-------
a1
a2
datetime
a4
a5
.....

i need distinct max between a1&a2 which i can get no problem but i cant get that unique datetime that correspond to a1&a2 in 1 query because this is will a subquery in a big query. Creating another temp table etc is not an option for me. for every specific a1 there is many entries of a2 + timedate etc.

create table abc_test (
id int
,runs int
,date1 datetime

[code]....

I can either get distinct ID + latest date or ID + largest #ofRuns, both will do but also need the third column.

View 5 Replies View Related

How To Display All Columns Of Distinct Rows

Apr 17, 2014

I have the below working query

select distinct OrderNum from invoiceHistory where orderNum in (56387,57930,57933,57935)

I need to get all columns of the distinct ordernum as resultset. I am working to get the resultset of below.

select invoiceID,distinct orderNum,invoiceDate from invoiceHistory where orderNum in (56387,57930,57933,57935)

View 1 Replies View Related

Selecting Distinct On 3 Columns In Ms Sql Server

Feb 26, 2006

Hi, I think you can do this in oracle but I'm trying to figure a way to do it in ms sql.. I need to select a distinct combination of columns, like so...

select distinct(ItemName,ItemData,FID) from tblSIFups

Does anyone know how to achieve that? I have multiple data where I shouldn't and I don't have any control over the application so I need to clean it this way.

thanks, nicki

View 1 Replies View Related

Count Of Distinct Rows Of Only Selected Columns?

Aug 9, 2012

I am trying to just get a count of the number of distinct rows are in a table --- not looking at the entire row of fields, but only selecting a few.

i don't want to see the distinct rows, i just want a count of how many are in the table.

View 4 Replies View Related

QUERY HELP: Selecting Distinct For Two Columns Group By One

Jul 23, 2005

Greetings.I'm having a little trouble with a query. The idea is simple I need todisplay a list of recently unique visited URLs and the last time Ivisited.I have 2 table one stores the user and time/date and another has theURL.So all I need is the URL (no duplicates) and the last visit.Below is the SQL to create the tables and data to help with the query.Thank you for your help.CREATE TABLE [stat_hits] ([hit_id] [int] (1, 1) NOT NULL ,[hit_date] [datetime] NOT NULL CONSTRAINT [DF_stat_hits_hit_date]DEFAULT (getdate()),[user_id] [varchar] (12) NOT NULL ,[hit_ip] [varchar] (15) NOT NULL ,[shp_id] [int] NOT NULL ,CONSTRAINT [PK_stat_hits] PRIMARY KEY CLUSTERED([hit_id]) ON [PRIMARY]) ON [PRIMARY]GOCREATE TABLE [stat_hit_pages] ([shp_id] [int] (1, 1) NOT NULL ,[shp_url] [varchar] (1000) NULL ,[shp_count] [int] NULL ,CONSTRAINT [PK_stat_hit_pages] PRIMARY KEY CLUSTERED([shp_id]) ON [PRIMARY]) ON [PRIMARY]GOINSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37878,'2005-06-01 16:07:35','ADMIN','0.0.0.0',7323)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37877,'2005-06-01 16:07:13','ADMIN','0.0.0.0',7323)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37876,'2005-06-01 15:41:17','ADMIN','0.0.0.0',7339)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37875,'2005-06-01 15:41:03','ADMIN','0.0.0.0',7323)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37874,'2005-06-01 15:20:31','ADMIN','0.0.0.0',7330)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37873,'2005-06-01 15:20:28','ADMIN','0.0.0.0',7338)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37872,'2005-06-01 14:45:46','ADMIN','0.0.0.0',7338)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37871,'2005-06-01 14:35:51','ADMIN','0.0.0.0',7338)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37870,'2005-06-01 14:30:25','ADMIN','0.0.0.0',7338)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37869,'2005-06-01 14:28:28','ADMIN','0.0.0.0',7338)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37868,'2005-06-01 14:28:23','ADMIN','0.0.0.0',7325)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37867,'2005-06-01 14:28:17','ADMIN','0.0.0.0',7322)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37866,'2005-06-01 14:28:15','ADMIN','0.0.0.0',7321)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37861,'2005-06-01 14:27:09','ADMIN','0.0.0.0',7339)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37860,'2005-06-01 14:27:05','ADMIN','0.0.0.0',7323)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37859,'2005-06-01 14:26:59','ADMIN','0.0.0.0',7322)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37858,'2005-06-01 14:26:58','ADMIN','0.0.0.0',7321)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37853,'2005-06-01 14:25:59','ADMIN','0.0.0.0',7338)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37852,'2005-06-01 14:23:51','ADMIN','0.0.0.0',7338)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37851,'2005-06-01 13:58:49','ADMIN','0.0.0.0',7338)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37850,'2005-06-01 13:44:06','ADMIN','0.0.0.0',7330)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37849,'2005-06-01 13:44:04','ADMIN','0.0.0.0',7321)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37848,'2005-06-01 13:44:04','ADMIN','0.0.0.0',7340)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37847,'2005-06-01 13:43:58','ADMIN','0.0.0.0',7330)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37846,'2005-06-01 13:43:53','ADMIN','0.0.0.0',7338)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37845,'2005-06-01 13:26:29','ADMIN','0.0.0.0',7325)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37844,'2005-06-01 13:22:34','ADMIN','0.0.0.0',7338)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37843,'2005-06-01 13:22:29','ADMIN','0.0.0.0',7325)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37842,'2005-06-01 13:21:15','ADMIN','0.0.0.0',7338)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37841,'2005-06-01 13:19:17','ADMIN','0.0.0.0',7338)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37840,'2005-06-01 13:17:20','ADMIN','0.0.0.0',7321)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37839,'2005-06-01 13:17:20','ADMIN','0.0.0.0',7320)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37838,'2005-06-01 11:55:15','ADMIN','0.0.0.0',7339)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37837,'2005-06-01 11:55:09','ADMIN','0.0.0.0',7323)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37836,'2005-06-01 11:53:08','ADMIN','0.0.0.0',7338)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37835,'2005-06-01 11:53:01','ADMIN','0.0.0.0',7325)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37834,'2005-06-01 11:34:34','ADMIN','0.0.0.0',7337)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37833,'2005-06-01 11:34:24','ADMIN','0.0.0.0',7336)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37832,'2005-06-01 11:02:59','ADMIN','0.0.0.0',7335)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37831,'2005-06-01 11:02:53','ADMIN','0.0.0.0',7334)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37830,'2005-06-01 11:02:46','ADMIN','0.0.0.0',7324)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37829,'2005-06-01 11:02:40','ADMIN','0.0.0.0',7333)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37828,'2005-06-01 11:02:31','ADMIN','0.0.0.0',7332)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37827,'2005-06-01 11:02:25','ADMIN','0.0.0.0',7323)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37826,'2005-06-01 11:02:21','ADMIN','0.0.0.0',7331)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37825,'2005-06-01 11:02:12','ADMIN','0.0.0.0',7323)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37824,'2005-06-01 11:01:23','ADMIN','0.0.0.0',7330)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37823,'2005-06-01 11:01:21','ADMIN','0.0.0.0',7328)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37822,'2005-06-01 11:01:20','ADMIN','0.0.0.0',7327)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37821,'2005-06-01 10:58:23','ADMIN','0.0.0.0',7330)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37820,'2005-06-01 10:58:10','ADMIN','0.0.0.0',7328)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37819,'2005-06-01 10:58:09','ADMIN','0.0.0.0',7327)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37818,'2005-06-01 10:55:27','ADMIN','0.0.0.0',7326)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37817,'2005-06-01 10:55:23','ADMIN','0.0.0.0',7325)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37816,'2005-06-01 10:55:17','ADMIN','0.0.0.0',7322)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37815,'2005-06-01 10:55:16','ADMIN','0.0.0.0',7321)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37810,'2005-06-01 10:54:20','ADMIN','0.0.0.0',7330)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37809,'2005-06-01 10:54:12','ADMIN','0.0.0.0',7329)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37808,'2005-06-01 10:51:30','ADMIN','0.0.0.0',7328)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37807,'2005-06-01 10:51:29','ADMIN','0.0.0.0',7327)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37806,'2005-06-01 10:51:10','ADMIN','0.0.0.0',7328)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37805,'2005-06-01 10:51:09','ADMIN','0.0.0.0',7327)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37804,'2005-06-01 10:35:46','ADMIN','0.0.0.0',7326)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37803,'2005-06-01 10:35:41','ADMIN','0.0.0.0',7325)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37802,'2005-06-01 10:35:29','ADMIN','0.0.0.0',7323)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37801,'2005-06-01 10:35:21','ADMIN','0.0.0.0',7321)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37800,'2005-06-01 10:35:20','ADMIN','0.0.0.0',7320)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37799,'2005-06-01 10:33:58','ADMIN','0.0.0.0',7321)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37798,'2005-06-01 10:33:50','ADMIN','0.0.0.0',7328)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37797,'2005-06-01 10:33:50','ADMIN','0.0.0.0',7327)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37796,'2005-06-01 10:33:09','ADMIN','0.0.0.0',7326)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37795,'2005-06-01 10:33:05','ADMIN','0.0.0.0',7325)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37794,'2005-06-01 10:32:45','ADMIN','0.0.0.0',7324)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37793,'2005-06-01 10:32:18','ADMIN','0.0.0.0',7323)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37792,'2005-06-01 10:31:47','ADMIN','0.0.0.0',7322)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37791,'2005-06-01 10:31:31','ADMIN','0.0.0.0',7321)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37790,'2005-06-01 10:31:31','ADMIN','0.0.0.0',7320)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37789,'2005-06-01 10:30:04','ADMIN','0.0.0.0',7320)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37788,'2005-05-31 20:49:56','ADMIN','0.0.0.0',7311)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37787,'2005-05-31 20:49:54','ADMIN','0.0.0.0',5942)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37786,'2005-05-31 20:49:54','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37785,'2005-05-31 20:49:02','ADMIN','0.0.0.0',5942)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37784,'2005-05-31 20:48:54','ADMIN','0.0.0.0',7311)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37783,'2005-05-31 20:48:53','ADMIN','0.0.0.0',5942)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37782,'2005-05-31 20:48:52','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37781,'2005-05-31 20:48:41','ADMIN','0.0.0.0',5941)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37780,'2005-05-31 20:48:37','ADMIN','0.0.0.0',215)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37779,'2005-05-31 20:48:30','ADMIN','0.0.0.0',4)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37775,'2005-05-31 20:46:44','ADMIN','0.0.0.0',7311)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37774,'2005-05-31 20:46:40','ADMIN','0.0.0.0',7319)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37773,'2005-05-31 20:46:39','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37772,'2005-05-31 20:46:12','ADMIN','0.0.0.0',7311)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37771,'2005-05-31 20:46:09','ADMIN','0.0.0.0',7319)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37770,'2005-05-31 20:46:08','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37769,'2005-05-31 20:45:55','ADMIN','0.0.0.0',7311)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37768,'2005-05-31 20:45:52','ADMIN','0.0.0.0',7319)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37767,'2005-05-31 20:45:51','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37766,'2005-05-31 20:45:33','ADMIN','0.0.0.0',7311)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37765,'2005-05-31 20:45:29','ADMIN','0.0.0.0',7319)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37764,'2005-05-31 20:45:29','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37763,'2005-05-31 20:45:28','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37762,'2005-05-31 20:44:52','ADMIN','0.0.0.0',7311)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37761,'2005-05-31 20:44:48','ADMIN','0.0.0.0',7319)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37760,'2005-05-31 20:44:47','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37759,'2005-05-31 20:44:23','ADMIN','0.0.0.0',7311)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37758,'2005-05-31 20:44:18','ADMIN','0.0.0.0',7319)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37757,'2005-05-31 20:44:18','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37756,'2005-05-31 20:43:50','ADMIN','0.0.0.0',6258)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37755,'2005-05-31 20:43:41','ADMIN','0.0.0.0',7311)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37754,'2005-05-31 20:43:37','ADMIN','0.0.0.0',7318)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37753,'2005-05-31 20:43:36','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37752,'2005-05-31 20:43:31','ADMIN','0.0.0.0',7317)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37751,'2005-05-31 20:43:16','ADMIN','0.0.0.0',7311)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37750,'2005-05-31 20:43:10','ADMIN','0.0.0.0',6684)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37749,'2005-05-31 20:43:10','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37748,'2005-05-31 20:40:04','ADMIN','0.0.0.0',7318)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37747,'2005-05-31 20:40:00','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37746,'2005-05-31 20:39:52','ADMIN','0.0.0.0',7317)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37745,'2005-05-31 20:39:24','ADMIN','0.0.0.0',7316)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37744,'2005-05-31 20:39:23','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37743,'2005-05-31 20:35:56','ADMIN','0.0.0.0',7315)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37742,'2005-05-31 20:35:43','ADMIN','0.0.0.0',7311)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37741,'2005-05-31 20:34:17','ADMIN','0.0.0.0',7314)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37740,'2005-05-31 20:34:17','ADMIN','0.0.0.0',1449)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37739,'2005-05-31 20:34:01','ADMIN','0.0.0.0',7313)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37738,'2005-05-31 20:33:54','ADMIN','0.0.0.0',7312)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37737,'2005-05-31 20:12:57','ADMIN','0.0.0.0',6681)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37736,'2005-05-31 20:09:40','ADMIN','0.0.0.0',6681)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37735,'2005-05-31 20:09:33','ADMIN','0.0.0.0',6258)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37734,'2005-05-31 20:09:03','ADMIN','0.0.0.0',6681)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37733,'2005-05-31 20:08:49','ADMIN','0.0.0.0',7289)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37732,'2005-05-31 20:08:44','ADMIN','0.0.0.0',6254)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37731,'2005-05-31 20:08:42','ADMIN','0.0.0.0',3443)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37730,'2005-05-31 20:08:40','ADMIN','0.0.0.0',7282)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37729,'2005-05-31 20:08:32','ADMIN','0.0.0.0',5983)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37728,'2005-05-31 20:08:24','ADMIN','0.0.0.0',6960)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37727,'2005-05-31 20:08:22','ADMIN','0.0.0.0',5918)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37726,'2005-05-31 20:08:18','ADMIN','0.0.0.0',25)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37725,'2005-05-31 20:08:15','ADMIN','0.0.0.0',5740)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37724,'2005-05-31 20:08:11','ADMIN','0.0.0.0',4)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37723,'2005-05-31 20:08:09','ADMIN','0.0.0.0',3)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37720,'2005-05-31 20:08:03','ADMIN','0.0.0.0',4)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37617,'2005-05-31 18:51:08','ADMIN','0.0.0.0',7290)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37615,'2005-05-31 18:51:00','ADMIN','0.0.0.0',7289)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37598,'2005-05-31 18:48:08','ADMIN','0.0.0.0',7282)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37597,'2005-05-31 18:48:04','ADMIN','0.0.0.0',6103)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37596,'2005-05-31 18:48:03','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37595,'2005-05-31 18:47:21','ADMIN','0.0.0.0',7282)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37594,'2005-05-31 18:47:12','ADMIN','0.0.0.0',6960)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37593,'2005-05-31 18:47:09','ADMIN','0.0.0.0',5918)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37592,'2005-05-31 18:47:02','ADMIN','0.0.0.0',5740)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37590,'2005-05-31 18:46:59','ADMIN','0.0.0.0',6587)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37583,'2005-05-31 18:46:40','ADMIN','0.0.0.0',9)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37582,'2005-05-31 18:46:31','ADMIN','0.0.0.0',1691)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37580,'2005-05-31 18:46:18','ADMIN','0.0.0.0',9)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37576,'2005-05-31 18:46:04','ADMIN','0.0.0.0',6979)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37575,'2005-05-31 18:46:02','ADMIN','0.0.0.0',5942)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37574,'2005-05-31 18:46:01','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37569,'2005-05-31 18:45:24','ADMIN','0.0.0.0',6979)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37568,'2005-05-31 18:45:16','ADMIN','0.0.0.0',6103)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37567,'2005-05-31 18:45:16','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37563,'2005-05-31 18:44:07','ADMIN','0.0.0.0',6979)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37562,'2005-05-31 18:44:05','ADMIN','0.0.0.0',6103)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37561,'2005-05-31 18:44:04','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37545,'2005-05-31 18:40:30','ADMIN','0.0.0.0',6979)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37544,'2005-05-31 18:40:30','ADMIN','0.0.0.0',6103)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37543,'2005-05-31 18:40:12','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37536,'2005-05-31 18:34:19','ADMIN','0.0.0.0',6979)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37535,'2005-05-31 18:34:15','ADMIN','0.0.0.0',6103)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37534,'2005-05-31 18:34:14','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37532,'2005-05-31 18:27:02','ADMIN','0.0.0.0',6979)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37531,'2005-05-31 18:27:00','ADMIN','0.0.0.0',6103)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37530,'2005-05-31 18:27:00','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37518,'2005-05-31 18:00:34','ADMIN','0.0.0.0',6979)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37517,'2005-05-31 18:00:31','ADMIN','0.0.0.0',6103)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37516,'2005-05-31 18:00:31','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37515,'2005-05-31 17:59:41','ADMIN','0.0.0.0',6979)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37514,'2005-05-31 17:59:37','ADMIN','0.0.0.0',6103)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37513,'2005-05-31 17:59:37','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37512,'2005-05-31 17:59:01','ADMIN','0.0.0.0',6979)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37511,'2005-05-31 17:58:58','ADMIN','0.0.0.0',6103)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37510,'2005-05-31 17:58:57','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37509,'2005-05-31 17:56:16','ADMIN','0.0.0.0',6610)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37508,'2005-05-31 17:56:07','ADMIN','0.0.0.0',6989)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37507,'2005-05-31 17:56:01','ADMIN','0.0.0.0',6610)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37506,'2005-05-31 17:55:56','ADMIN','0.0.0.0',7271)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37505,'2005-05-31 17:55:52','ADMIN','0.0.0.0',7199)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37504,'2005-05-31 17:55:43','ADMIN','0.0.0.0',7271)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37503,'2005-05-31 17:55:41','ADMIN','0.0.0.0',7199)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37502,'2005-05-31 17:53:57','ADMIN','0.0.0.0',7269)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37501,'2005-05-31 17:53:44','ADMIN','0.0.0.0',6979)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37500,'2005-05-31 17:53:40','ADMIN','0.0.0.0',6103)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37499,'2005-05-31 17:53:40','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37498,'2005-05-31 17:52:18','ADMIN','0.0.0.0',7269)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37497,'2005-05-31 17:52:06','ADMIN','0.0.0.0',7271)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37496,'2005-05-31 17:51:28','ADMIN','0.0.0.0',6979)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37495,'2005-05-31 17:51:22','ADMIN','0.0.0.0',6103)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37494,'2005-05-31 17:51:22','ADMIN','0.0.0.0',31)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37493,'2005-05-31 17:51:01','ADMIN','0.0.0.0',6979)INSERT INTO [stat_hits]([hit_id],[hit_date],[user_id],[hit_ip],[shp_id]) VALUES(37492,'2005-05-31 17:50:57','ADMIN','0.0.0.0',6103)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(3,'/scripts/iMenu.asp?_Ref=450493&_XID=40000000&ParentID=',2245)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(4,'/scripts/objects/MyZBF.asp?_XID=19999900&_Ref=450493&_Ref2=',2917)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7329,'/scripts/objects/list.asp?_XID=70000005&_Ref=1398186089&_reset=true&_table=2002000&|MenuID=40000000',0)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7330,'/scripts/objects/edit.asp?_XID=70000005&_Ref=1398186089&_table=2002000&_item=ADAMDOUG',5)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7331,'/scripts/objects/edit.asp?_XID=70000028&_Ref=1398186089&_table=1002009&_item=225000000',0)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7332,'/scripts/objects/edit.asp?_XID=70000028&_Ref=1398186089&_table=1002009&_item=215000000',0)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7333,'/scripts/objects/list.asp?_XID=70000028&_Ref=1398186089&_table=1002009&',0)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7334,'/scripts/objects/list.asp?_XID=70000028&_Ref=1398186089&_table=1001000&_parenturl=1',0)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7335,'/scripts/objects/edit.asp?_XID=70000028&_Ref=1398186089&_table=1001000&_item=1002009&_parenturl=1',0)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7336,'/scripts/objects/edit.asp?_XID=70000028&_Ref=1398186089&_table=1001054&_item=1000006&_parenturl=3',0)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7337,'/scripts/objects/edit.asp?_xid=70000028&_ref=1398186089&_table=1001054&&_parenturl=3',0)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7338,'/scripts/objects/navigator.asp?_xid=70000030&_ref=1398186089',12)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7339,'/scripts/objects/navigator.asp?_xid=70000028&_ref=1398186089',2)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7340,'/scripts/iKnow.asp?_ref=1398186089&_deep=http%3A//ZBFw2kdev01/scripts/objects/edit.asp%3F_XID%3D70000005%26_Ref%3D1398186089%26_ table%3D2002000%26_item%3DADAMDOUG',0)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(9,'/scripts/objects/list.asp?_XID=70000052&_Ref=450493&_reset=true&_table=215000001&|MenuID=40000000',1532)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(25,'/scripts/objects/list.asp?_XID=70000028&_Ref=450493&_reset=true&_table=1002009&|MenuID=40000000',144)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(31,'/scripts/objects/save.asp?',3986)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(215,'/scripts/objects/list.asp?_XID=70000030&_Ref=450493&_reset=true&_table=3001062&|MenuID=40000000',138)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(1449,'/scripts/objects/mappings.asp?',17)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(1691,'/scripts/objects/edit.asp?_XID=70000052&_Ref=450493&_table=215000001&_item=11',26)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(3443,'/scripts/objects/list.asp?_XID=70000028&_Ref=450493&_table=1001000&_parenturl=2',16)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(5740,'/scripts/objects/consolemaster.asp?_XID=80000003&_Ref=450493&_reset=true&showall=false&page_id=215000002&|MenuID=40000000',177)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(5918,'/scripts/objects/consolemaster.asp?_XID=80000003&_Ref=450493&showall=false&mode=listitself&item=215000006&page_id=215000002',15)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(5941,'/scripts/objects/edit.asp?_XID=70000030&_Ref=450493&_table=3001062&_item=12',9)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(5942,'/scripts/objects/edit.asp?_XID=70000030&_Ref=450493&_table=3001062&_item=12&_formtab=&process=&step=&elem=',62)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(5983,'/scripts/objects/edit.asp?_XID=70000028&_Ref=450493&_table=1002009&_item=225000000',15)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(6103,'/scripts/objects/edit.asp?_XID=70000028&_Ref=450493&_table=1001002&_parenturl=3&_item=215000018&_formtab=&process=&step=&elem=',21)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(6254,'/scripts/objects/edit.asp?_XID=70000028&_Ref=450493&_table=1001000&_item=225000001&_parenturl=2',4)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(6258,'/scripts/objects/edit.asp?_XID=70000028&_Ref=450493&_table=1001000&_item=225000001&_parenturl=2&',4)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(6587,'/scripts/objects/consolemaster.asp?_XID=80000004&_Ref=450493&_reset=true&showall=false&page_id=215000003&|MenuID=40000000',81)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(6610,'/scripts/objects/consolemaster.asp?_XID=80000004&_Ref=450493&showall=false&page_id=215000003',88)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(6681,'/scripts/objects/edit.asp?_XID=70000028&_Ref=450493&_table=1001054&_item=225000175&_parenturl=4',3)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(6684,'/scripts/objects/edit.asp?_XID=70000028&_Ref=450493&_table=1001054&_parenturl=4&_item=225000175&_formtab=&process=&step=&elem=',7)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(6960,'/scripts/objects/edit.asp?_XID=80000003&_Ref=450493&_table=215000001&_item=68',3)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(6979,'/scripts/objects/edit.asp?_XID=70000052&_Ref=450493&_table=215000001&_item=161&process=215000001&step=215000003&elem=215000018',25)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(6989,'/scripts/objects/consolemaster.asp?_XID=80000004&_Ref=450493&showall=false&mode=drill&item=215000120&drill_id=215000005&page_id=215000003&group=1&desc=BTFG',54)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7199,'/scripts/objects/consolemaster.asp?_XID=80000004&_Ref=450493&showall=false&page_id=215000006',24)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7269,'/scripts/objects/consolemaster.asp?_XID=80000004&_Ref=450493&showall=false&page_id=215000010',3)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7271,'/scripts/objects/consolemaster.asp?_XID=80000004&_Ref=450493&showall=false&mode=listitself&item=215000200&page_id=215000006&group=1&desc=Operations%20Executive',3)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7282,'/scripts/objects/edit.asp?_XID=80000003&_Ref=450493&_table=215000001&_item=68&process=215000001&step=215000003&elem=215000018',2)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7289,'/scripts/objects/edit.asp?_xid=80000003&_ref=450493&_table=225000001&_item=75&_parenturl=1',1)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7290,'/scripts/objects/edit.asp?_xid=80000003&_ref=450493&_table=215000016&_item=86&_parenturl=1',0)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7311,'/scripts/objects/edit.asp?_XID=80000003&_Ref=450493&_table=225000001&_item=75',11)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7312,'/scripts/objects/showpopup.asp?_XID=80000003&_Ref=450493&_table=225000001&_item=75&destable=225000001&_mode=mappings&_seed=72528.66',0)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7313,'/scripts/objects/mappings.asp?_XID=80000003&_Ref=450493&_table=225000001&_item=75&destable=225000001&_mode=mappings&_seed=72528.66&_popup=true',0)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7314,'/scripts/objects/edit.asp?_XID=80000003&_Ref=450493&_table=225000001&_item=90&process=&step=&elem=',0)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7315,'/scripts/objects/edit.asp?_xid=80000003&_ref=450493&_table=225000001&_item=90',0)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7316,'/scripts/objects/edit.asp?_xid=80000003&_ref=450493&_table=225000001&_item=90&_formtab=0&process=&step=&elem=',0)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7317,'/scripts/objects/edit.asp?_xid=80000003&_ref=450493&_table=215000016&_item=86',1)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7318,'/scripts/objects/edit.asp?_xid=80000003&_ref=450493&_table=215000016&_item=86&_formtab=&process=&step=&elem=',1)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7319,'/scripts/objects/edit.asp?_XID=70000028&_Ref=450493&_table=1001000&_parenturl=2&_item=225000001&_formtab=&process=&step=&elem=',5)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7320,'/scripts/iknow.asp?_Ref=1398186089',6)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7321,'/scripts/iMenu.asp?_Ref=1398186089&_XID=40000000&ParentID=',10)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7322,'/scripts/objects/MyZBF.asp?_XID=19999900&_Ref=1398186089&_Ref2=',9)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7323,'/scripts/objects/list.asp?_XID=70000028&_Ref=1398186089&_reset=true&_table=1002009&|MenuID=40000000',8)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7324,'/scripts/objects/edit.asp?_XID=70000028&_Ref=1398186089&_table=1002009&_item=1000001',1)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7325,'/scripts/objects/list.asp?_XID=70000030&_Ref=1398186089&_reset=true&_table=3001062&|MenuID=40000000',6)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7326,'/scripts/objects/edit.asp?_XID=70000030&_Ref=1398186089&_table=3001062&_item=12',2)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7327,'/scripts/objects/save.asp?',4)INSERT INTO [stat_hit_pages] ([shp_id],[shp_url],[shp_count]) VALUES(7328,'/scripts/objects/edit.asp?_XID=70000030&_Ref=1398186089&_table=3001062&_item=12&_formtab=&process=&step=&elem=',4)

View 2 Replies View Related

Transact SQL :: How To Get Distinct Count Of All Columns Of A Table

Dec 3, 2015

I have a table called Employee which have 6 columns. This table are having 1000 records. Now I want to know the distinct value count of all these 6 columns as well as normal count. like this:

ColumnName DistinctCount NormalCount
Id 1000 1000
Name 1000 1000
Phone 600 600
PINCode 200 1000
City 400 1000
Gender 2 1000

View 5 Replies View Related

Transact SQL :: Select And Parse Json Data From 2 Columns Into Multiple Columns In A Table?

Apr 29, 2015

I have a business need to create a report by query data from a MS SQL 2008 database and display the result to the users on a web page. The report initially has 6 columns of data and 2 out of 6 have JSON data so the users request to have those 2 JSON columns parse into 15 additional columns (first JSON column has 8 key/value pairs and the second JSON column has 7 key/value pairs). Here what I have done so far:

I found a table value function (fnSplitJson2) from this link [URL]. Using this function I can parse a column of JSON data into a table. So when I use the function above against the first column (with JSON data) in my query (with CROSS APPLY) I got the right data back the but I got 8 additional rows of each of the row in my table. The reason for this side effect is because the function returned a table of 8 row (8 key/value pairs) for each json string data that it parsed.

1. First question: How do I modify my current query (see below) so that for each row in my table i got back one row with 19 columns.

SELECT A.ITEM1,A.ITEM2,A.ITEM3,A.ITEM4, B.*
FROM PRODUCT A
CROSS APPLY fnSplitJson2(A.ITEM5,NULL) B

If updated my query (see below) and call the function twice within the CROSS APPLY clause I got this error: "The multi-part identifier "A.ITEM6" could be be bound.

2. My second question: How to i get around this error?

SELECT A.ITEM1,A.ITEM2,A.ITEM3,A.ITEM4, B.*, C.*
FROM PRODUCT A
CROSS APPLY fnSplitJson2(A.ITEM5,NULL) B,  fnSplitJson2(A.ITEM6,NULL) C

I am using Microsoft SQL Server 2008 R2 version. Windows 7 desktop.

View 14 Replies View Related

T-SQL (SS2K8) :: Select Group On Multiple Columns When At Least One Of Non Grouped Columns Not Match

Aug 27, 2014

I'd like to first figure out the count of how many rows are not the Current Edition have the following:

Second I'd like to be able to select the primary key of all the rows involved

Third I'd like to select all the primary keys of just the rows not in the current edition

Not really sure how to describe this without making a dataset

CREATE TABLE [Project].[TestTable1](
[TestTable1_pk] [int] IDENTITY(1,1) NOT NULL,
[Source_ID] [int] NOT NULL,
[Edition_fk] [int] NOT NULL,
[Key1_fk] [int] NOT NULL,
[Key2_fk] [int] NOT NULL,

[Code] .....

Group by fails me because I only want the groups where the Edition_fk don't match...

View 4 Replies View Related

SELECT INTO A New Table All Columns Based On DISTINCT Value Of One Column

Oct 31, 2014

‘Trying to SELECT INTO a new table all columns of a table based on a DISTINCT value of one column so for example:

SELECT *
INTO new_table
FROM old_name
WHERE old_table.column IS DISTINCT’

View 4 Replies View Related

Distinct With Multiple Tables

Apr 4, 2007

hi friends

i have a query like this

query1="select co.*, ct.*, from contacts co, enquiries en, contactPersonType ct where co.co_contactId=en.en_contactId and co.co_contactType=ct.ct_contactTypeId"

i want to display only the contact persons details who made enquires.
this gives me duplicate records. im not displaying enquiry details. how can i use distinct with this?

thank you
neon

View 8 Replies View Related

Select With Multiple Column And Distinct

Jun 22, 2008

Hi guys, I'm hoping there's someone out there with more sql knowledge and experience than me. I'll try to explain everything.

I'm trying to create a select statement but i'm not gettting the required results mainly because i think its a very complicated select.

Here is the scenario.

The table has 12 columns

ProductID Colour MD01 MD02 MD03 MD04 MD05 MD06 MD07 MD08 MD09 MD010


The ProductID is naturally the unique key.

There is always a colour value. But there is not always a value in the MD columns. For example one Product may have values in MD01 MD02 MD03 MD04 MD05 whilst another has values in all MD columns.

My problem is thatI am trying to create a results list based upon selecting distinct values from the colour and md columns

In otherwords i can't have more than only one instance of a word appearing in the recordset list

I'm really struggling with this because there are only 6 colours so if i set distinct purely on 6 colours i only get back 6 rows.

When I try to set disctinct across all the MD columns it seems to ignore it and lists results for example in the table

ProductID Colour MD01 MD02 MD03 MD04 MD05 MD06 MD07 MD08 MD09 MD010
1 red car bike
2 blue bike car train

my select lists results as
red
car
bike
blue
bike
car
train

and it is as if it only carries out the distinct command across the row not across all columns for all rows if you see what i mean?

I need to be able to list all data from all rows that have values in the MD columns and colour column but not list the values more than once and not list "empty" (NULL) columns. Does this make sense?

This is the select statement i wrote.

Select DISTINCT md00, md01, md02, md03, md04, md05, md06, md07, md08, md09, md10, colour FROM TEMPLATES WHERE md00 IS NOT NULL or md01 IS NOT NULL or md02 IS NOT NULL or md03 IS NOT NULL or md04 IS NOT NULL or md05 IS NOT NULL or md06 IS NOT NULL or md07 IS NOT NULL or md08 IS NOT NULL or md09 IS NOT NULL or md10 IS NOT NULL

But it returns empty columns and it returns every instance of the same word so in other words the distinct command doesn't seem to be working at all?

I don't know if this is because of my asp code I am trying to list results with the rescordset?

<%
While ((Repeat1__numRows <> 0) AND (NOT template_rs.EOF))
%>

<%=(template_rs.Fields.Item("md01").Value)%>
<%=(template_rs.Fields.Item("md02").Value)%>
<%=(template_rs.Fields.Item("md03").Value)%>
<%=(template_rs.Fields.Item("md04").Value)%>
<%=(template_rs.Fields.Item("md05").Value)%>
<%=(template_rs.Fields.Item("md06").Value)%>
<%=(template_rs.Fields.Item("md07").Value)%>
<%=(template_rs.Fields.Item("md08").Value)%>
<%=(template_rs.Fields.Item("md09").Value)%>
<%=(template_rs.Fields.Item("md10").Value)%>
<%=(template_rs.Fields.Item("colour").Value)%>

<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
template_rs.MoveNext()
Wend
%>


I have one more problem. How can I also in addition to being able to list all distinct results list only results for a specific letter

for example

Select DISTINCT md00, md01, md02, md03, md04, md05, md06, md07, md08, md09, md10, colour FROM TEMPLATES WHERE md00 IS NOT NULL or md01 IS NOT NULL or md02 IS NOT NULL or md03 IS NOT NULL or md04 IS NOT NULL or md05 IS NOT NULL or md06 IS NOT NULL or md07 IS NOT NULL or md08 IS NOT NULL or md09 IS NOT NULL or md10 IS NOT NULL WHERE FIRST LETTER ='A'?


I am so far out of my depth here guys I am hoping that someone who has real knowledge of SQL can help me with this statement. I've been pulling my hair out for days now and getting just more and more frustrated listing the same results :(

-BB

View 20 Replies View Related

Integration Services :: Insert Multiple Columns As Multiple Records In Table Using SSIS?

Aug 10, 2015

Here is my requirement, How to handle using SSIS.

My flatfile will have multiple columns like :

ID  key1  key2  key3  key 4

I have SP which accept 3 parameters ID, Key, Date

NOTE: Key is the coulm name from the Excel. So my sp call look like

sp_insert ID, Key1, date
sp_insert ID, Key2,date
sp_insert ID, Key3,date

View 7 Replies View Related

T-SQL (SS2K8) :: Selecting Data From Table With Multiple Conditions On Multiple Columns

Apr 15, 2014

I am facing a problem in writing the stored procedure for multiple search criteria.

I am trying to write the query in the Procedure as follows

Select * from Car
where Price=@Price1 or Price=@price2 or Price=@price=3
and
where Manufacture=@Manufacture1 or Manufacture=@Manufacture2 or Manufacture=@Manufacture3
and
where Model=@Model1 or Model=@Model2 or Model=@Model3
and
where City=@City1 or City=@City2 or City=@City3

I am Not sure of the query but am trying to get the list of cars that are to be filtered based on the user input.

View 4 Replies View Related

How To Merge Multiple Rows One Column Data Into A Single Row With Multiple Columns

Mar 3, 2008



Please can anyone help me for the following?

I want to merge multiple rows (eg. 3rows) into a single row with multip columns.

for eg:
data

Date Shift Reading
01-MAR-08 1 879.880
01-MAR-08 2 854.858
01-MAR-08 3 833.836
02-MAR-08 1 809.810
02-MAR-08 2 785.784
02-MAR-08 3 761.760

i want output for the above as:

Date Shift1 Shift2 Shift3
01-MAR-08 879.880 854.858 833.836
02-MAR-08 809.810 785.784 761.760
Please help me.

View 8 Replies View Related

Transact SQL :: Query To Convert Single Row Multiple Columns To Multiple Rows

Apr 21, 2015

I have a table with single row like below

 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Column0 | Column1 | Column2 | Column3 | Column4|
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Value0    | Value1    | Value2    | Value3    |  Value4  |

Am looking for a query to convert above table data to multiple rows having column name and its value in each row as shown below

_ _ _ _ _ _ _ _
Column0 | Value0
 _ _ _ _ _ _ _ _
Column1 | Value1
 _ _ _ _ _ _ _ _
Column2 | Value2
 _ _ _ _ _ _ _ _
Column3 | Value3
 _ _ _ _ _ _ _ _
Column4 | Value4
 _ _ _ _ _ _ _ _

View 6 Replies View Related

SQL Server 2012 :: Concatenate Multiple Rows In Multiple Columns

Aug 5, 2014

I concatenate multiple rows from one table in multiple columns like this:

--Create Table
CREATE TABLE [Person].[Person_1](
[BusinessEntityID] [int] NOT NULL,
[PersonType] [nchar](2) NOT NULL,
[FirstName] [varchar](100) NOT NULL,
CONSTRAINT [PK_Person_BusinessEntityID_1] PRIMARY KEY CLUSTERED

[Code] ....

This works very well, but I want to concatenate more rows with different [PersonType]-Values in different columns and I don't like the overhead, of using the same table in every subquery ([Person_1]). Is there a more elegant way to do this, without using a temp table or something else?

View 1 Replies View Related

Obtaining Data To Be Displayed In Multiple Columns From Multiple Rows

Apr 23, 2008



Hello All,

I am rather new to reporting on SQL Server 2005 so please be patient with me.

I need to create a report that will generate system information for a server, the issue im having is that the table I am having to gather the information from seems to only allow me to pull off data from only one row.

For example,. Each row contains a different system part (I.e. RAM) this would be represented by an identifier (1), but I to list each system part as a column in a report

The table (System Info) looks like:-

ID | System part |
1 | RAM
2 | Disk Drive
10| CPU
11| CD ROM |

Which


So basically I need it to look like this.

Name | IP | RAM | Disk Drive|
----------------------------------------------
A | 127.0.0.1 | 512MB | Floppy

So Far my SQL code looks like this for 1 item
SELECT SYSTEM PART
FROM System Info
WHERE System.ID = 1

How would I go about displaying the other system parts as columns with info

Any help is much appreciated!


View 3 Replies View Related

Multiple Columns With Different Values OR Single Column With Multiple Criteria?

Aug 22, 2007

Hi,

I have multiple columns in a Single Table and i want to search values in different columns. My table structure is

col1 (identity PK)
col2 (varchar(max))
col3 (varchar(max))

I have created a single FULLTEXT on col2 & col3.
suppose i want to search col2='engine' and col3='toyota' i write query as

SELECT

TBL.col2,TBL.col3
FROM

TBL
INNER JOIN

CONTAINSTABLE(TBL,col2,'engine') TBL1
ON

TBL.col1=TBL1.[key]
INNER JOIN

CONTAINSTABLE(TBL,col3,'toyota') TBL2
ON

TBL.col1=TBL2.[key]

Every thing works well if database is small. But now i have 20 million records in my database. Taking an exmaple there are 5million record with col2='engine' and only 1 record with col3='toyota', it take substantial time to find 1 record.

I was thinking this i can address this issue if i merge both columns in a Single column, but i cannot figure out what format i save it in single column that i can use query to extract correct information.
for e.g.;
i was thinking to concatinate both fields like
col4= ABengineBA + ABBToyotaBBA
and in search i use
SELECT

TBL.col4
FROM

TBL
INNER JOIN

CONTAINSTABLE(TBL,col4,' "ABengineBA" AND "ABBToyotaBBA"') TBL1
ON

TBL.col1=TBL1.[key]
Result = 1 row

But it don't work in following scenario
col4= ABengineBA + ABBCorola ToyotaBBA

SELECT

TBL.col4
FROM

TBL
INNER JOIN

CONTAINSTABLE(TBL,col4,' "ABengineBA" AND "ABB*ToyotaBBA"') TBL1
ON

TBL.col1=TBL1.[key]

Result=0 Row
Any idea how i can write second query to get result?

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved