Grouping records by category name


Table data structure is:

link_id | name | url | category
--------------------------------------------------------------------
1 | SitePoint Forums | http://sitepoint.com/forums | Programming

I'd like to produce a list of links, grouped by category, such as

Programming Links
> link 1
> link 2

Music Links
> link 1
> link 2

Can you help with the query I need that would help produce this
Posted On: Monday 31st of December 2012 01:06:26 AM Total Views:  557
View Complete with Replies

RELATED TOPICS OF MYSQL PROGRAMMING LANGUAGE




multiple grouping in the same result set

I have the following table for students' grades Code: StudentID CourseID Grade 1 1 90 1 2 95 1 3 80 2 1 100 2 2 75 2 3 65 I want to display the count of grades for each student based on a specific distribution, for example: Code: StudentID Above90 80to90 70to79 lessthan70 1 1 2 0 0 2 1 0 1 1 Is it possible to write a query extracting the needed result set
VIEWS ON THIS POST

113

Posted on:

Thursday 25th October 2012
View Replies!

Date grouping

Morning! I have, what I believe to be, a complex problem. I need to be able to group dates into a period, and then count the number of periods between two dates. Let me provide you with a simplified example... Imagine each calendar month is defined as a period in time. They have a start and end date, and in total that means there are 12 periods. Then imagine you have two dates: 1st August and 30th October. To calculate the number of periods these two dates span over is simple on paper, it's 3 months: August, September, October. However, what if you start moving around the periods of time so instead of dealing with months we are dealing with database-defined periods: period(period_name, start_date, end_date) Some sample data might be: Code: period_name start_date end_date -------------------------------------- 1 2008-08-01 2008-09-07 2 2009-09-08 2008-10-02 So my question is, given two dates, how can I return the name of all periods (in chronological order) that lie in the range of the two dates.
VIEWS ON THIS POST

233

Posted on:

Thursday 25th October 2012
View Replies!

Mysql table max size

what is mysql max table size in win/unix (i can not find out its link in mysql.com if someone please send me it link)
VIEWS ON THIS POST

138

Posted on:

Monday 29th October 2012
View Replies!

The data types text and varchar are incompatible in the add operator.

I am getting this error when I try to execute my stored procedure. This is SQL Server 2005 The data types text and varchar are incompatible in the add operator. I am assuming it's because I do @searchCriteria + '%' But I don't know any other way to add the % to the parameter ALTER PROCEDURE [dbo].[snpBasicSeach] (@searchCriteria text) as SELECT SourceName, DocumentType, LastEditType, Advisor, Author, Descriptor, DoDTechnologyArea, AuthAffiliation, Degree, CorpAuth, DocumentDate, Title, TitleClass, URL, FileSize, DocumentClass, DistributionStmt, Abstract, AbstractClass FROM vtdThesisInfo WHERE Advisor LIKE @searchCriteria + '%' OR (Author LIKE @searchCriteria) OR (Descriptor LIKE @searchCriteria) OR (DoDTechnologyArea LIKE @searchCriteria) OR (Degree LIKE @searchCriteria) OR (DocumentDate LIKE @searchCriteria) OR (Title LIKE @searchCriteria) OR (DistributionStmt LIKE @searchCriteria) OR (Abstract LIKE @searchCriteria) or (Descriptor LIKE @searchCriteria) or (DoDTechnologyArea LIKE @searchCriteria) or (Degree LIKE @searchCriteria) or (DocumentDate LIKE @searchCriteria) or (Title LIKE @searchCriteria) or (DistributionStmt LIKE @searchCriteria) or (Abstract LIKE @searchCriteria)
VIEWS ON THIS POST

204

Posted on:

Wednesday 7th November 2012
View Replies!

New table in SQL

I've create a new table in SQL 2000 with the following fields: EquipmentNo. Equipment Desc. Date I don't want to be able to enter the same data in the EquipmentNo. field, do I just make this field a primary key
VIEWS ON THIS POST

77

Posted on:

Wednesday 7th November 2012
View Replies!

Please help this Sproc or whatever

I would like to return a recordset that only includes those that meet first criteria but there is no record for second criteria ordered by [Action Date] Desc first RS Criteria select [contract id], [ActionDate] from contractactiontable where ([ActionDate] between '01/01/2005' and '06/30/2005') and ([Department] = 8 and [ActionType] = 1) order by [ActionDate] Desc second Criteia select [contract id], [ActionDate] from contractactiontable where ([ActionDate] between '01/01/2005' and '06/30/2005') and ([Department] = 1 and [ActionType] = 1) order by [ActionDate] Desc so essentially do first Select and return only those that test false (EOF) of second Select Do this for thousands of records so overhead in Webserver would be huge to complie. hoping SQL Server could do
VIEWS ON THIS POST

84

Posted on:

Wednesday 7th November 2012
View Replies!

Help Please - 2 Table Query

Need help on database query I got 2 table. Table 1 fields : 1)date_test 2)totalC1 Table 2 fields : 1)date_test 2)channel1 3)channel2 4)channel3 How do I write a SQL query to extract table2's field (channel1 to channel3) based on 2 criterias, must match date_test and totalC1 from table1 It can be more than one field, such as example below, Table1 date_test | totalC1 ------------------- 11-05-05 | 5500 15-06-04 | 500 Table2 date_test | channel1 | channel2 | channel3 ------------------------------------------- 11-05-05 | 5500 | 50 | 5500 Where when I query date 11/05/2005, I get channel1 and channel3 as result. I don't know how to do this, please help.
VIEWS ON THIS POST

55

Posted on:

Wednesday 7th November 2012
View Replies!

Unclosed Database Sessions and aspx

Originally posted by : Edi (edid@agur.co.il)We work with OracleClient and SQLClien connections and Asp.Net. IIS not close SQL Server and Oracle Session connections. This sessions closed only after restart IIS.How can we solve this problem
VIEWS ON THIS POST

64

Posted on:

Wednesday 7th November 2012
View Replies!

SQL Connection using web.config

hi... the attach img is my error.. and following is my code: Code: Dim connection As SqlConnection Dim strCon As String Dim sqlcmd As SqlCommand Dim builder As New StringBuilder builder.Append("INSERT INTO Profile ") builder.Append("(") builder.Append("name,") builder.Append("userid,") builder.Append("password,") builder.Append("gender,") builder.Append("email,") builder.Append("birthDate,") builder.Append("contact") builder.Append(") ") builder.Append("VALUES ") builder.Append("(") builder.Append("'" & name.Text & "', ") builder.Append("'" & username.Text & "',") builder.Append(("'" & pass1.Text & "', ")) builder.Append(("'" & gender.Text & "', ")) builder.Append(("'" & email.Text & "', ")) builder.Append(("'" & birth.Text & "', ")) builder.Append(("'" & contact.Text & "'")) builder.Append(") ") strCon = ConfigurationManager.AppSettings("ConnectionString") connection = New SqlConnection(strCon) sqlcmd = New SqlCommand(builder.ToString, connection) connection.Open() sqlcmd.ExecuteNonQuery() i m trying to get the pre defined connection string that is in my web.config file of my website..
VIEWS ON THIS POST

98

Posted on:

Saturday 10th November 2012
View Replies!

Select statement and Distinct or Group By

I am trying to return a single referance to a each unique master record (FILM_PROD_GUDE.RECNO). Because I am returning fields with different values from related tables (FILM_SUBCAT_REF.SUBNO), I am returning multiple instances of the master record RECNO. Can I use a GROUP BY function to get what I want or am I looking at this whole thing the wrong way. Any help would be appreciated.................... thanks dan "SELECT DISTINCT FILM_PROD_GUIDE.RECNO, FILM_SUBCAT_REF.SUBNO, FILM_PROD_GUIDE.ORGANIZATION, FILM_PROD_GUIDE.CON_FIRST, FILM_PROD_GUIDE.CON_PFX, FILM_PROD_GUIDE.CON_LAST, FILM_PROD_GUIDE.STREET_ONE, FILM_PROD_GUIDE.CITY, FILM_PROD_GUIDE.STATE, FILM_PROD_GUIDE.ZIP, FILM_PROD_GUIDE.PHONE_DAY, FILM_SUBCAT_REF.SUBCAT, FILM_CATEGORY.CREW_NO, FILM_CATEGORY.CREW_DESCRIPTION FROM FILM_SUBCAT_REF INNER JOIN FILM_CATEGORY ON FILM_SUBCAT_REF.SUBNO = FILM_CATEGORY.SUBCAT_KEY INNER JOIN FILM_PROD_GUIDE ON FILM_CATEGORY.ORG_NO = FILM_PROD_GUIDE.RECNO WHERE FILM_PROD_GUIDE.RECNO > 0 AND FILM_SUBCAT_REF.SUBNO= " + Int64.Parse(SubCat.Text.ToString()) " AND LOWER(ORGANIZATION) LIKE '%" + myName.ToLower() + "%'" " AND LOWER(CITY) LIKE '%" + myCity.ToLower() + "%'" " AND LOWER(CON_LAST) LIKE '%" + myLast.ToLower() + "%'" " AND ORG_ACTIVE = 1 AND CREW_CAT_ACTIVE = 1 ORDER BY SUBCAT,ORGANIZATION
VIEWS ON THIS POST

111

Posted on:

Saturday 10th November 2012
View Replies!

ODBC - User DSN, System DSN, File DSN???

hi, i use user dsn for my sql server.... have any difference about user dsn , system dsn and file dsn can anyone tell me ...
VIEWS ON THIS POST

42

Posted on:

Saturday 10th November 2012
View Replies!

whats went wrong ?

did i miss out anything! Code: strSQL = "Select Attempting FROM Attempts WHERE (studentID = '" & Session("StudID") & "') AND (Paper ='"& CT2004S1 &"')" Select Attempting FROM Attempts WHERE (studentID = '024053J') AND (Paper ='')
VIEWS ON THIS POST

102

Posted on:

Saturday 10th November 2012
View Replies!

UPDATE: MySQL Auto Backup & Export v1.1

SwordSky Software http://www.swordsky.com/ MySQL Auto Backup & Export is a Windows program to backups/exports your data automatically from MySQL databases to file or other database. File formats including SQL, PHP, CSV, XML, HTML, TXT. Databases including MySQL. MySQL Auto Backup & Export includes a task wizard, which allows you to Create a task, Edit a task, View the properties of task. Task type following: Backup/Export data to File: including SQL, PHP, CSV, XML, HTML, TXTBackup/Export data to Database: including MySQLExecute SQL Script: executes SQL script automatically Main functions and features MySQL data types supported. Windows 95/98/Me/NT/2000/XP/2003 supported. Run remotely or locally with the MySQL databases. Backup/Export data from a MySQL database to file automatically. Backup/Export data from a MySQL database to another automatically. Execute SQL Script automatically. Backup/Export to 6 standard file formats: SQL, PHP, CSV, XML, HTML, TXT. Backup/Export from tables from different databases on one host. Task management perfect, including Create, Edit, Delete, View, Startup, Stop, Run immediately and run automatically. Records log for every task and be able to view. Save and Load the list of tasks. Login by username and password. Auto run on Windows startup. Download MySQL Auto Backup & Export at http://www.swordsky.com to help you. -------------------------------------------- SwordSky Software http://www.swordsky.com/ MySQL Auto Backup & Export http://www.swordsky.com/myautobak/MyAutoBackup.exe Backup/Restore/Export/Import/Move/Sync your data automatically from MySQL database to file or database. Executes SQL script automatically in MySQL database. Don't worry about your data in MySQL anytime! They will not to be lost because I am running!
VIEWS ON THIS POST

64

Posted on:

Saturday 10th November 2012
View Replies!

Numbering a query in SQL Server

Originally posted by : Carlo (raffic@tin.it)I've to number the records in a SQL query made with SQL Server 2000. I need a field containing the number of that specific row starting from 1 and ending with the number of records retrieved.Example1, Field1, Field2, Field2....., FieldN2, Field1, Field2, Field2....., FieldN3, Field1, Field2, Field2....., FieldN.....N, Field1, Field2, Field2....., FieldNWhere the first field will contain the row number.Can someone help me
VIEWS ON THIS POST

126

Posted on:

Saturday 10th November 2012
View Replies!

SQL 7 stats from ASP?

Originally posted by : wk (skrecycle@rediffmail.com)Do you know how can I get the current stats like the server resources, load, processor load etc. from my ASP scriptI need this info for my load balancing pages.thanx.
VIEWS ON THIS POST

44

Posted on:

Saturday 10th November 2012
View Replies!

Is this possible?

Originally posted by : KC (kc@circuitcellar.com)I want to collect credit card info, subscription legnth, and email address. I want a password assigned for each email address that is vaild for the legnth of the subscription.Each month I want to an email message sent out to all valid addresses for that month. It should contain the password and a URL. The page they would be sent to would vaildate the password and let them download a specific file.Is this possible Any samples I could start from
VIEWS ON THIS POST

82

Posted on:

Saturday 10th November 2012
View Replies!

Auto-increment ID when adding recs to SQL

Originally posted by : aj (aj@aimpro.co.uk)When I'm adding records to SQL via ASP, how can I determine a unique ID number
VIEWS ON THIS POST

127

Posted on:

Saturday 10th November 2012
View Replies!

Updating Records in Multiple Tables

I already know how to upate records in multiple tables via recordsets. I would like to know how to update records in multiple tables using a stored procedure. I am not exactly sure how you could do this. Here's my code: strSql = "Update DomainName Set DomainName=@DomainName, Registrar=@Registrar,ExpirationDate=@ExpirationDat e, BusinessName=@BusinessName, ClientID=@ClientID From DomainName D Join Clients C On D.ClientID=C.ClientID Where DomainNameID=@DomainNameID" cmdSql = New SqlCommand( strSql, conDomainName ) cmdSql.Parameters.Add( "@DomainName", strDomainName ) cmdSql.Parameters.Add( "@Registrar", strRegistrar ) cmdSql.Parameters.Add( "@ExpirationDate", ExpirationDate) cmdSql.Parameters.Add( "@BusinessName", BusinessName) cmdSql.Parameters.Add( "@ClientID", intClientID) cmdSql.Parameters.Add( "@DomainNameID", intDomainNameID ) BusinessName is from the Clients Table. The other fields are from the DomainName Table.
VIEWS ON THIS POST

60

Posted on:

Sunday 11th November 2012
View Replies!

displaying last 3 records

Originally posted by : andrew (harrison@tiscalinet.it)id like to dispaly on a page the last 3 records to be inserted in a database.how do i do this
VIEWS ON THIS POST

118

Posted on:

Sunday 11th November 2012
View Replies!

before i mess up my DB...

is this a valid SQL query SQLtemp = "INSERT into [users] WHERE ([username]) = '" & usernameIn & "' ([code]) VALUES ('" & request.form("txtCode") & "')" or SQLtemp = "INSERT into [users] ([code]) VALUES ('" & request.form("txtCode") & "') WHERE ([username]) = '" & usernameIn & "'"
VIEWS ON THIS POST

76

Posted on:

Monday 12th November 2012
View Replies!

Administrate SQL SERVER 6.5 Via WEB

Originally posted by : TOUMI Fethi (toumi.f@decade.fr)hi,can we administrate sql server 6.5 via WebIf yes how we must configure the clients microsoft sql entreprise manager, isql_w, ms querry ...) to accees to the server byein french :Bonjour, peut-on administrer sql server 6.5 = distance : installer les outils =clients sql (microsoft sql entreprise manager, isql_w, ms querry ...) et =se connecter sur un serveur via le web pour l'administrer. Si, oui : comment doit-on configurer le serveur et les outils =clients. Si non, les versions les plus rcentes (version 7 et ult=E9rieures) =permettent -elles ce type d'adminstration Merci d'avance.
VIEWS ON THIS POST

76

Posted on:

Thursday 15th November 2012
View Replies!

Database table copy ?

Originally posted by : Guillaume (guillaume@tilbury.fr)
VIEWS ON THIS POST

115

Posted on:

Thursday 15th November 2012
View Replies!

Validation for users when sign up for event

, I want to create php system that will validate when users register for the event today (for example), it will check in mysql database if they did not registered for this event before. Any suggestions welcome.
VIEWS ON THIS POST

98

Posted on:

Monday 19th November 2012
View Replies!

SQL Syntax Error

Just wondering if anyone could help me with this error: "You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '))' at line 1" Also, I'm working on creating a Time Zone and if possible, I would like a little information as to how the one for this site works. I truly appreciate the help.
VIEWS ON THIS POST

57

Posted on:

Monday 19th November 2012
View Replies!


I am a super noob to ASP and SQL but I am trying my best to learn. Please dont take this as a "please make a script for me!" post but rather someone asking for guidance: basically am i going the right way Is there an easier/better way of doing what I'm trying to achieve. Any links that you might have are also appreciated of course. now that i've gotten that out of the way... allow me to pose my situation: I am trying to create a form where users enters: nameemailGroup Name (just a variable text)upload a file (.doc)i also want the script to automatically enter in two more pieces of info into my table: timestamp for submission of docset status of .doc file to pendingand to provide the user with a unique ID for their submission so that they may enter it to update their .doc documents and upload them again. curretnly i have this as my code (i am using code from asp101 as a template) - please note that I am aware that I am not done, that is why I am here - asking for help. Code: ' primary code taken from http://www.asp101.com 'Create an ADO connection to a database 'load the includes file for the conn's used
VIEWS ON THIS POST

205

Posted on:

Monday 19th November 2012
View Replies!

one more problem...

I just stumbeled over another problem i hope you can help me with Having the following tables: Dept ------- *Deptname Owes Emp ------ *Name DeptName (foreign key: Dept.DeptName) Car ------ *CarNr OutTo (foreign key: Emp.Name) Cost The outout I want is: DeptName, Liability (for now the liability is just the cars cost), Total (what the department owes + liability) not including the it dept and depts owing less than/equal to 1400 My sql query looks like the following: SELECT d.DeptName, c.Cost AS Liability, d.Owes + Liability AS Total FROM Dept d, Emp e, Car c WHERE d.DeptName = e.DeptName AND e.Name = c.OutTo AND d.DeptName 'IT' AND d.Owes >= 1400 The problem is that I get one of the deptnames listed several times, because there's more than one person borrowing a car in that dept. Do you understand the problem I'm not sure how to explain it. Any suggestions on the solution
VIEWS ON THIS POST

152

Posted on:

Monday 19th November 2012
View Replies!

Binary to ASCII and visa versa

Originally posted by : Paul Distant (pdistant@linneydesign.com)I'm trying to read an ascii file to be converted into a binary file.How do I then read the binary file and convert it back into ascii!Any ideas
VIEWS ON THIS POST

60

Posted on:

Tuesday 20th November 2012
View Replies!

How to Join multiple DB's?

Guys, I have never used a Join before so I am trying to learn. Most of the info out there is for joining tables inthe same DB. I understand this. However, I need to join two DB's. I have one SQL DB with a "Courses" table and one Sybase DB with a "Courses" table. I need to join them on a field called oldLMSID in the SQL DB and course_id in the sybase db. SQL DB Table: courses Field: oldLMSID Sybase DB Table: tr_course Field: course_id Can someone tell me where to start I don't even know how I am supposed to connect to each one with one connection string.
VIEWS ON THIS POST

115

Posted on:

Tuesday 20th November 2012
View Replies!

How to write sql statement for this kind of condition?

i have a table that keep record of all available items and another table to keep record of used items. i need to write statement that display unused item. may i know how to write the sql statement for this condition
VIEWS ON THIS POST

84

Posted on:

Tuesday 20th November 2012
View Replies!

If statement stored procedure

its peebman2000 again, i'm having trouble with a stored procedure. I have learned and found a way to set up reminder emails using sql 2005 job scheduleing tool. The email works, but I need to write the stored procedure correctly to execute correctly. Below is my stored procedure i'm trying to write and it's not working. Basically I'll have an email address and a deadline date column: Table: Deadline(Id, email, deadline) So I'll schedule SQL to check the table everyday at noon, and to select the email and deadline date. If the deadline date = system date then send email to the email address. And that were i'm struggling at. Can anyone give me any assistance on writing this type of stored procedure, i'm not too familiar with the if statement in SQL, I've done case statement but not IF statement.
VIEWS ON THIS POST

205

Posted on:

Tuesday 20th November 2012
View Replies!

outputing result into text file and email

I need to generate a text file of my sql query and email it systematically. Does anyone know how
VIEWS ON THIS POST

96

Posted on:

Tuesday 20th November 2012
View Replies!

Language Setting MS SQL collation and sort order

Originally posted by : Roy Koshy (roykoshy@yahoo.com)I have a problem with MS SQL Server collation. Arabic htm meta tag windows charset = 1256. SQL collation name SQL_Latin1_General_Cp1256_CS_AS or CI-AS OR Binary all tried. With sql 7 and 2000. with Arabic language enabled server windows 2000. the cases I can view Arabic. String comparison also working. But the query Analyzer and Enterprise manager show garbage data in the tables. Can anyone help me to write Arabic on an sql server table and able to view Arabic data even if I open and see a table directly form enterprise manager or Query Analyzer.
VIEWS ON THIS POST

82

Posted on:

Tuesday 20th November 2012
View Replies!

how to use connect string while connecting to informix database useing odbc

Originally posted by : Ram (rbsaroj@rediffmail.com)hello i am faceing problem in connectstringi am able to connect informix rdbms databse by useing odbc from visual basic . But i am not ableto connect to databse by useing same odbc connect string through my ASP page . Can anybody help me with sending exact syntax my email id is rbsaroj@rediffmail.co
VIEWS ON THIS POST

109

Posted on:

Tuesday 20th November 2012
View Replies!

Scalable SQL cannot create the external index file.

Originally posted by : mike ricard (michelricard@hotmail.com)Here is the message that I receive from sql after multiple openings of a connectionMicrosoft OLE DB Provider for ODBC Drivers error '80004005' [Pervasive Software][ODBC Interface][Pervasive Software SQL Engine]Scalable SQL cannot create the external index file. I can open and execute the code from the sql string 95 % of the time, but somehow, sometime, ireceived this message.Does anyone know what's going on, am I missing somethingPlease Help, my site goes live this coming tuesday !!!!michelricard@hotmail.com sqlItemsList = "SELECT DND_Garment_Master.LOGISTIK_NUMBER,DND_Garment_Mas ter.GENERIC_NSN, DND_Garment_Master.PTS_VALUE, DND_Inventory_Header.SPECIFIC_NSN, DND_Garment_Master.NAME_ENGLISH, DND_Garment_Master.NAME_FRENCH, DND_Inventory_Header.SIZE FROM DND_Garment_Master, DND_Inventory_Header WHERE DND_Garment_Master.GENERIC_NSN = DND_Inventory_Header.GENERIC_NSN AND (((DND_Garment_Master.ITEM_Type) = "&OrderFlag&")) AND ((DND_Inventory_Header.Special_Size) = 0) ORDER BY DND_Garment_Master.GENERIC_NSN, DND_Inventory_Header.SPECIFIC_NSN"
VIEWS ON THIS POST

134

Posted on:

Tuesday 20th November 2012
View Replies!

Most current class

all... I'm confused again and hopefully someone can help me out. I have a table called RegResults that contains Registration records with PeopleID and ClassID that are link values to other tables named People and Class. There are many registration records in the RegResults table for every person. What I'm trying to do is find the latest ClassID for each Person in registered in the RegResults table. I tried this but not getting the results I need. SELECT MAX(r.ID) AS id, r.ClassID, r.PeopleID FROM RegResults AS r WHERE r.SeriesID='2' GROUP BY r.ClassID, r.PeopleID, r.ID ORDER BY r.PeopleID
VIEWS ON THIS POST

57

Posted on:

Tuesday 20th November 2012
View Replies!

SQL Select

Okay, I need some advice. I have a function that calculates the distance between two points. It uses latitudes and longitudes stored in a DB to calculate this distance. No problems there. My question is this though: How do I create a SQL statement to incorporate this distance calculate in my SELECT statement In other words, if someone says I want to search for all companies located within 100 miles of zip code 46589, it would run the SQL, and return the results. Is this possible to accomplish in one query Currently, this is my code, however, I am using multiple queries and then having to sort the distances as well (shortest distance to longet): Code: Set grabDist = siteConn.Execute("SELECT distID, distName, distAddress1, distAddress2, distCity, distState, distPhoneNumber, distEmail, distWebsite, distZipCode, distProducts, distLatitude, distLongitude FROM tblDistributors" & findProduct & " ORDER BY distZipCode ASC") If Not grabDist.EOF Then Do While Not grabDist.EOF zipCode = Trim(grabDist("distZipCode")) If Len(zipCode) = 5 Then If grabDist("distLatitude") AND grabDist("distLongitude") Then intDistance = Round(calcDistance(intLatitude, intLongitude, grabDist("distLatitude"), grabDist("distLongitude")), 1) If CInt(intDistance)
VIEWS ON THIS POST

85

Posted on:

Tuesday 20th November 2012
View Replies!

Help in select clause

I'm trying to make a select statement wich goes fetch all records that belong to the interval of january and march. Select count(*) as total From Ocorrencias Where Mes = 'Janeiro' , Mes = 'Fevereiro' , Mes = 'Maro' and Ano = ano I know this code is wrong with the "," there. who might help with this
VIEWS ON THIS POST

108

Posted on:

Tuesday 20th November 2012
View Replies!

Tricky Counting Query

I've got a SQL query that's almost working. As shown in this screenshot, I'm trying to display the # of comments that have been submitted to a given post, blog-style, as well as the # of comments that have a particular status (not yet reviewed.) http://www.thephelpsgroup.com/temp/comments.gif In the database, there's currently only 1 comment been made to each, for 4 of the 6 posts, and two comments for just one of them. Rather than keeping them distinct to the posts they were in response to, it's adding them up as it goes. Can anybody help me sort this out so I'm only displaying the pending and total comments for a given post Thank you if so! Code: SELECT DISTINCT Stories.story_id, Stories.status AS storystatus, Stories.fname, Stories.lname, Stories.city, Stories.state, Stories.submitoccasion, Stories.storytitle, COUNT(StoryCommentsTotal.comments) AS commentstotal, COUNT(StoryCommentsTotal.comments) AS commentspending FROM Stories LEFT OUTER JOIN StoryComments StoryCommentsTotal ON Stories.story_id = StoryCommentsTotal.story_id_FK LEFT OUTER JOIN StoryComments StoryCommentsPending ON Stories.story_id = StoryCommentsTotal.story_id_FK AND StoryCommentsTotal.status = 1 WHERE (Stories.status = 1) GROUP BY Stories.story_id, Stories.status, Stories.fname, Stories.lname, Stories.city, Stories.state, Stories.submitoccasion, Stories.storytitle ORDER BY storystatus DESC, Stories.submitoccasion
VIEWS ON THIS POST

74

Posted on:

Tuesday 20th November 2012
View Replies!

SQL Reporting Services

Is anyone out there using SQL Reporting Services If so, I have a question for you. I am using the jump to URL option in my report. The report is rendered by SQL Reporting Services, and it works just fine. However, I get the following error message on the page everytime I use the jump to URL feature: "Object doesn't support this property or method". The odd thing is, that it works fine otherwise, but I only see this error on the pages I have set as links from other reports (using the URL instead of the Jump to Report feature). It does not seem to matter whether the destination report is part of the project or not, however, it should be noted that the links are created dynamically based on the parameters of the report. I create the string using the Expression Builder in SQL Reporting Services. Any ideas Is this a Microsoft problem
VIEWS ON THIS POST

60

Posted on:

Tuesday 20th November 2012
View Replies!

My SQL table creation

, I'm taking the jump from Access to My SQL and have a few questions. What field types should I be using and would give me the best out of my database My table will have fields like the following: Key Username Firstname Lastname Email LastUpdated (Date/Time) LastActive(Date/Time) Level (this can be up to two characters and can either be numeric or alphabet) What do these attributes mean Binary, Unsigned, Unsigned Zerofill When should I allow the field to be Null What does it mean to set the field to be Primary and Index
VIEWS ON THIS POST

75

Posted on:

Tuesday 20th November 2012
View Replies!


SQL Query help - How can I extract totals followed by details in one query ieJob1 total 3 descr date descr date descr dateJob2 total 2 desc date desc date
VIEWS ON THIS POST

7

Posted on:

Tuesday 20th November 2012
View Replies!

selecting records with a word somewhere in a field

Originally posted by : Michael Haseltine (haseltin@u.arizona.edu) all:I posted this in the asp forum, but just found this list and figure it's more appropriate here.I want to select records that have a word somewhere in a field, and I thought 'like' wouldwork, but it's not. Here's what I'm doing:select * from bibliography where keyword like 'myword'However, it only selects records where myword is the only word in the field. I've also triedputting asterisks inside the single quotes, but then it doesn't select ANY records.Any guidance here greatly appreciated.
VIEWS ON THIS POST

83

Posted on:

Tuesday 20th November 2012
View Replies!

For Next Loop Not Working

I'm getting a runtime error on a for next loop and need: Here's my code: Code:   The Error I'm getting is: Microsoft VBScript runtime error '800a01a8' Object required: '[string: "1G4HR52K7VH448793, 2"]' Looking at the URL parameters that are being passed it's not putting the value in the number 2 spot like I expected. I get the same error when only one option/parameter is being passed as well. Thank you for any help. Natalie
VIEWS ON THIS POST

63

Posted on:

Monday 26th November 2012
View Replies!

Search Problem

I'm producing a search that when a section is chosen from a drop down menu the search only searches the selected section. The problem is the code below searches others sections as well as the selected one. strSQL = "SELECT * FROM qry_Policies WHERE SectionID = " & request.Form("section") & " AND title like'" & txtSearch & "' or keywords like '%" & txtSearch & "' OR keywords like '" & txtSearch & "%' OR keywords like '%" & txtSearch & "%' AND '" & txtSearch & "' OR title like '%" & txtSearch & "' OR title like '" & txtSearch & "%' OR title like '%" & txtSearch & "%' ORDER by title"
VIEWS ON THIS POST

115

Posted on:

Monday 26th November 2012
View Replies!

order by an alias?

I have problems with the following sql query: SELECT c.CarNr, c.Make, c.OutTo, c.OutOn, (t.Date - c.OutOn)+1 AS Days, c.Cost, Days * c.Cost AS Total FROM Cars c, Today t WHERE c.OutOn null ORDER BY Total Asc I get the error: Too few parameters. Expected 1. If I try to order by c.Cost it works. Is there a problem with ordering on an alias It seems like it doesn't find it.. I hope someone can help me
VIEWS ON THIS POST

103

Posted on:

Monday 26th November 2012
View Replies!

how to cut short a string?

Originally posted by : kamp (kamph@netease.com)the string saved by MSSQLserver will has some zeros at it's tail. After i get the string from MSSQLserver, how to cut it into exactly what it is (i use c#)
VIEWS ON THIS POST

99

Posted on:

Monday 26th November 2012
View Replies!

how to conver access into sql?

to I'm new and i'm happy that i have found this. I had a question which might have been asked many times: how do I convert access codes into sql I have this data base in access which needs to be in sql . I wanted to know if i have to write codes or something else. I have office xp and sql server 2000 personal edition. hope to get an answer very soon.
VIEWS ON THIS POST

401

Posted on:

Monday 26th November 2012
View Replies!

Incorrect syntax near (ASP.NET)

This snipts works fine with OLEDB and MS Access database but in SQL Server mode gives: System.Data.SqlClient.SqlException: Line 1: Incorrect syntax near ')'. Public Sub bindArchive() Dim sqlConn As New SqlConnection(ConfigurationSettings.AppSettings("S QLString")) 'Dim strSQL As String = "SELECT DISTINCT Month(news_pdate), Year(news_pdate) FROM(news) ORDER BY Month(news_pdate) DESC" Dim myCommand As New SqlCommand("SELECT DISTINCT Month(news_pdate), Year(news_pdate) FROM(news) ORDER BY Month(news_pdate) DESC", sqlConn) Dim myDataReader As SqlDataReader sqlConn.Open() myDataReader = myCommand.ExecuteReader() dlsArchive.DataSource = myDataReader dlsArchive.DataBind() myDataReader.Close() sqlConn.Close() sqlConn.Dispose() End Sub Have any idea
VIEWS ON THIS POST

148

Posted on:

Monday 26th November 2012
View Replies!

How to upload the character '

Originally posted by : kaarthik (kaarthik@singnet.com.sg)I seem to have a problem when i try to add the character ' into a database....let's say an article contains these single quotations: ' . When i wish to add the article into the database the character is replaced by some other funny characters...OR if does not even upload....Pls help...
VIEWS ON THIS POST

221

Posted on:

Monday 26th November 2012
View Replies!