| | |
Grab data from alternate rows
Please support our ColdFusion advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Sep 2008
Posts: 337
Reputation:
Solved Threads: 27
I'm kinda confused so you have a table column 1 column 2 column 3, row 1 row 2 row 3 row 4 row 5 and you want var1 to show row 1,3 and 5 and var2 to show row 2,4 and 6 ?
You can set the sql statement so var1 shows columnA and var2 shows ColumnX but not sure if you can skip rows.
You can set the sql statement so var1 shows columnA and var2 shows ColumnX but not sure if you can skip rows.
Last edited by freshfitz; Jun 18th, 2009 at 9:16 am.
•
•
•
•
I'm kinda confused so you have a table column 1 column 2 column 3, row 1 row 2 row 3 row 4 row 5 and you want var1 to show row 1,3 and 5 and var2 to show row 2,4 and 6 ?
You can set the sql statement so var1 shows columnA and var2 shows ColumnX but not sure if you can skip rows.
Table:
Column 1, Column 2, Column 3, Column 4
Row 1
Row 2
What I want now is:
var 1 = Row1.Column3
var 2 = Row2.Column4
•
•
Join Date: Sep 2008
Posts: 337
Reputation:
Solved Threads: 27
If there is only 2 rows this should work
ColdFusion Syntax (Toggle Plain Text)
<cfquery name="Query1" datasource="#application.dsn#"> select column 3 // replace with name of column 3 from TableName // replace with the table name in the data base where tableName.Column 3 = 'The vAlue in the database that is at row1 colum3 keep i inside these quotes' </cfquery> <cfquery name="Query2" datasource="#application.dsn#"> select column 4 // replace with name of column 4 from TableName // replace with the table name in the data base where tableName.Column 4 = 'the value data in of Row2 Column4' </cfquery> <cfoutput> <tr> <td width="10"><div class="content_black">#Query1.Column3# </div></td> <td width="10"><div class="content_black">#Query2.Column4# </div></td> </tr> </cfoutput>
Last edited by freshfitz; Jun 18th, 2009 at 9:15 pm.
•
•
Join Date: Mar 2008
Posts: 11
Reputation:
Solved Threads: 1
•
•
•
•
Actually, there are only 2 rows. So like the following:
Table:
Column 1, Column 2, Column 3, Column 4
Row 1
Row 2
What I want now is:
var 1 = Row1.Column3
var 2 = Row2.Column4
coldfusion Syntax (Toggle Plain Text)
<cfquery name="blah" datasource="#dsn3"> select * from table </cfquery> <cfoutput> <cfloop query="blah"> row:#CurrentRow# mod2:#CurrentRow MOD 2#<br> <cfloop> </cfoutput>
Last edited by peter_budo; Jul 24th, 2009 at 2:29 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
![]() |
Similar Threads
- updating multiple rows with one form (PHP)
- how to grab data from access and manipulate it (Visual Basic 4 / 5 / 6)
- How to Grab the data from other websites? (PHP)
- data grabbing from html sites (Python)
- Insert Data in to Db from the Dynamic Rows (HTML and CSS)
- add data in col, 2D arrays (C++)
- ASP display data in 3 col & rows using CSS layout (ASP)
- Working with SQL's Text data type (ASP.NET)
Other Threads in the ColdFusion Forum
- Previous Thread: Is it possible to install a Wordpress blog as part an existing coldfusion website?
- Next Thread: Data Mining Coldfusion
| Thread Tools | Search this Thread |





